From: Nikolai Weibull Date: 2010-03-06T02:25:02+09:00 Subject: [ruby-core:28515] Re: [Feature #905] Add String.new(fixnum) to preallocate large buffer On Fri, Mar 5, 2010 at 17:25, Caleb Clausen wrote: > On 3/5/10, Yusuke ENDOH wrote: >> 2010/3/5 Kornelius Kalnbach : >>> How big would the buffer size have to be for this template? >>> >>> ��

<%= link_to @record.name, @record %>

>> Yes, it is generally difficult to determine the size. >> >> We may be able to estimate it by using domain knowledge in some cases. >> (e.g., certain page size is empirically known as about 10KB, etc.) >> But if the expectation is disappointed, it will cause wasteful memory >> allocation or no speed up. > Generally, a given template should expand to about the same size every > time. I���m getting the feeling thath the only real use case that we���ve got for this so far is ERb. Wouldn���t it make more sense to change the way ERb (and similar ���string concatenators���) creates its result?