From: Aman Gupta Date: 2013-04-18T06:02:42+09:00 Subject: [ruby-core:54408] Re: frozen strings (was: [patch] reduce allocations due to __FILE__ ...) On Wed, Apr 17, 2013 at 11:49 AM, Eric Wong wrote: > "headius (Charles Nutter)" wrote: >> I'd like to work with you to find more places we could be sharing >> frozen strings. A change over the summer made defined? results always >> be shared frozen strings, and apparently that was a source of lots and >> lots of extra string creation in Rails (according to wycats). There's >> many other such opportunities. > > I've considered (but never got around to implementing/testing) caching > for rb_str_dup_frozen. This might help with hashes which use common > strings as keys (e.g. CGI params and HTTP headers). > > Perhaps one of you can experiment with this before I can get around > to it.. > I actually started on this a few weeks ago. I added a frozen string cache and was able to remove a large number of duplicated strings from the Ruby heap. I'll clean up the patch and open a redmine issue for review. Aman