On Friday, September 14, 2012 9:03:32 AM UTC-4, Gary Weaver wrote: > > On Thursday, September 13, 2012 5:38:57 PM UTC-4, Masterleep wrote: > >> Excellent! I verified that your fix did eliminate the redundancy on >> these field name strings in the case I was studying (from 15 extra strings >> per instance down to 2, where the 2 were attribute values, not field names). >> > > Attribute values would be a good case for the StringPool I guess, even > though I still think that would be something that should be introduced in > Ruby, not Rails, and because of string's bang methods altering the object > itself so a lot of existing user code would assume object_id equivalence of > a string and the object produced by one of that string's bang methods, so > it would be a major change. I know you wanted to focus on AR, but if you > did only focus on AR attribute values and just had a StringPool for them, > then AR attribute values would be object equivalent and have the same > string bang method wierdness, but other strings wouldn't act that way, and > this would be much more evil than doing it in Ruby. >
Take a look at these: Bartosz DziewoĆski wrote in post #1077524: > http://patshaughnessy.net/2012/1/4/never-create-ruby-strings-longer-than-23-characters > http://patshaughnessy.net/2012/1/18/seeing-double-how-ruby-shares-string-values That probably doesn't help because the Ruby optimization happens for strings that are 23 chars are more, and I guess that most attribute names are shorter (and many attribute values may be also). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/XeK4Q7R5UwgJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
