On Oct 5, 2011, at 9:10 AM, Axel Rauschmayer wrote:

>> The two concatenation approaches I know of are:
>> 1. via +=
>> 2. push() into an array, join() it after the last push()
>> (1) can’t possibly be efficient,
>> Huh? Engines have optimized the hell out of 1 by essentially doing 2 under 
>> the hood. Even rhino's about a land a patch to do just that.
>> but if (2) is OK on all(!) platforms, then a library would be OK. However, 
>> given how frequently this is used, I would like this to become part of the 
>> standard library.
>> What exactly do you want supported?
> Something like Java’s StringBuilder. If, however, (2) collects the 
> concatenated substrings and only joins them on demand in current engines, 
> then there is indeed no need for such a thing.

(1) is faster on modern engines.

I don't think we need to overdo it here. SunSpider already did :-/.


es-discuss mailing list

Reply via email to