[ruby-core:77262] RFC: optimizations opportunities in Hash#merge!
From:
Sylvain Joyeux <sylvain.joyeux@13robotics.com>
Date:
2016-09-13 16:57:31 UTC
List:
ruby-core #77262
Hello everyone. I'm using Hash#merge and other hash-related update methods extensively, to the point where I spend a significant amount of time in #hash. So I went digging. It appears that Hash#merge is actually re-hashing its keys twice (once to compare the two hashes, and once to re-assign to the receiver). However, under the assumption that the block in Hash#merge! is not allowed to modify the key, no hashing should be needed at all. Or am I missing something ? I am ready to work on this, but I want to have a feel for whether such work would be welcome by the code devs before I invest time in it ... rather than have it thrown away as WONTFIX later. Regards, Sylvain Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>