Project

General

Profile

« Previous | Next » 

Revision 2cf5fe58

Added by segiddins (Samuel Giddins) about 2 years ago

[rubygems/rubygems] Avoid allocating empty hashes in Index

Since the hashes have a default proc that returns a (new) empty hash, we
can avoid allocating those empty hashes when we are only doing lookups.

Test from running bundle update --bundler against a rails app I have
lying around:

==> memprof.after.txt <== Total allocated: 9.71 MB (68282 objects) Total retained: 4.87 MB (33791 objects) ==> memprof.before.txt <== Total allocated: 10.83 MB (100596 objects) Total retained: 5.02 MB (34721 objects) 

https://github.com/rubygems/rubygems/commit/8f7c9cb23e