Yeah, I've refused a previous patch on related grounds - this should be a language implementation target. I'm glad to hear that reached patches. Previously, back in the 1.8 days, I benched the aforementioned patch and it was slower than allocating the strings. It turns out that a simple Rack app, when you bench, will happily free these objects and not suffer major problems under high load with the allocations. If I remember correctly the prior patch added constant and method lookup time due to adding hierarchy too. On Fri, Oct 3, 2014 at 1:08 PM, Eric Wong wrote: > Hi all, this is about a recent rack.git commit: > dc53a8c26dc55d21240233b3d83d36efdef6e924 > > I don't disagree with this commit at this time, but I hope much of > it will become unnecessary as older versions of Ruby get phased out. > > Since Ruby 2.1.0, constant string keys are deduplicated in hash > literals. Thus the following reuses the same "key" string in every > case: > > { "key" => val } > # ref: r44058 > > Ruby 2.2 (coming December 2014) will also deduplicate the "key" literal > allocation for lookups and assignment on regular hashes: > > regular_hash["key"] # opt_aref_with (in insns.def) > regular_hash["key"] = val # opt_aset_with > > This speeds up the Rack env hash, but unfortunately won't help with > Rack::Utils::HeaderHash :< > (ref: r44551 + a few subsequent bugfixes) > > We originally planned to support dedupe for all strings (not just > literals), but that caused performance regressions :< > > On a related note, Ruby 2.2 will also use power-of-two sized hash > tables, speeding up lookups/assignments a little > (~10-20%, CPU-dependent) for String keys [Feature #9425] > > This only applies to mainline Ruby, I am not up-to-date with > Rubinius/JRuby internals. > > Thanks for reading! > > -- > > --- > You received this message because you are subscribed to the Google Groups > "Rack Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rack-devel+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "Rack Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.