From: "Pavel R." Date: 2010-12-22T18:56:02+09:00 Subject: Re: Regexp, String, Symbol literals' object_ids > What kind of "problem" are going to need do so many packs/unpacks that > this part (constant or string) will make much difference? Working with binary protocols. Smth. like https://github.com/pavelrosputko/em-oscar/blob/master/em-oscar/icbm.rb Much difference? Actually not so much in icbm.rb source above. But one wrote at http://redmine.ruby-lang.org/issues/show/4184#note-3 I've been able to get 2-3% improvements in Rails apps by simply rewriting some 'constant's and inline Arrays as CONSTANTs. I have patches to MRI that use cached, immutable Strings for the internal #to_s messages on immutable objects; e.g. changing Symbol#to_s, Float#to_s, Bignum#to_s, Rational#to_s, etc. to return the same frozen String instance. I measured 1-6% performance improvement in the standard MRI tests. -- Posted via http://www.ruby-forum.com/.