Re: String concatenation

2011-10-07 Thread Tom Schuster
I think you just documented this: http://www.yafla.com/dforbes/String_Concatenation_and_Immutable_Strings_Speeding_Spidermonkey/ On Fri, Oct 7, 2011 at 2:01 AM, Wes Garland w...@page.ca wrote: On 6 October 2011 14:09, Tom Schuster t...@schuster.me wrote: (1) is in  fact really good optimized

Re: String concatenation

2011-10-06 Thread Brendan Eich
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.

Re: String concatenation

2011-10-06 Thread Wes Garland
On 6 October 2011 14:09, Tom Schuster t...@schuster.me wrote: (1) is in fact really good optimized in modern engines. (In case you are interested search for Ropes: an alternative to strings) You don't even need ropes to make this fast for a lot of common cases. I think even a naive

String concatenation

2011-10-05 Thread Axel Rauschmayer
Is this worthy of ES.next support? Or does it belong into a library? 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, but if (2) is OK on all(!) platforms, then a library would be OK. However,

Re: String concatenation

2011-10-05 Thread Dean Landolt
On Wed, Oct 5, 2011 at 11:45 AM, Axel Rauschmayer a...@rauschma.de wrote: Is this worthy of ES.next support? Or does it belong into a library? 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,

Re: String concatenation

2011-10-05 Thread Dmitry Soshnikov
On 05.10.2011 19:45, Axel Rauschmayer wrote: Is this worthy of ES.next support? Or does it belong into a library? 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, but if (2) is OK on all(!)

Re: String concatenation

2011-10-05 Thread Axel Rauschmayer
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.

Re: String concatenation

2011-10-05 Thread John Tamplin
On Wed, Oct 5, 2011 at 12:10 PM, Axel Rauschmayer a...@rauschma.de 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