[Pharo-dev] Efficient string concatenation - proposed new
tudor at tudorgirba.com
Sun Nov 17 23:58:14 EST 2013
Hmm, I knew it would be slower, but I did not expect this slowdown.
Thank you both for the explanations. Something to learn every single day :).
On Sun, Nov 17, 2013 at 9:54 PM, Andres Valloud <
avalloud at smalltalk.comcastbiz.net> wrote:
> We’re only measuring execution speed, not memory allocation, which is
>> important too.
> Yes. And besides having to collect the garbage at some point, allocation
> can be costly because the VM has to zero out the string bytes (or nil them
> if the string is not encoded) and then write on those zeroed (nilled)
> places with something else. It takes time.
> The length of the strings is a variable as well, of course.
> The order also matters, e.g.
> (String new: 7812681237643287423), 'a', 'b', 'c'
> and the way you aggregate the result matters as well.
> Conclusion, let’s be careful with a too simple advice.
> Yes, it's much more complex than it seems when the inefficiency of naive
> concatenation methods is not flagrant.
"Every thing has its own flow"
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev