Status of Array extras in ECMA 4
David Golightly
davigoli at gmail.com
Sat Sep 1 11:44:27 PDT 2007
On 9/1/07, Lars T Hansen <lth at acm.org> wrote:
>
> On 9/1/07, David Golightly <davigoli at gmail.com> wrote:
> > Given the significant performance boost from moving this sort of
> iteration
> > into machine code from interpreted code,
>
> I don't agree with that assertion at all (or, I don't agree that
> ECMAScript implementations are necessarily "interpreted", most are
> compiling to byte code now and some are compiling to native code).
> And even so, the overhead of calling the user function and collecting
> the results is likely to dominate the running time of these functions.
Ok, I was going comparing Firefox 2.0's native implementation of
Array.prototype.forEach against their JavaScript version (eg from here:
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach#Compatibility),
which though exactly compatible, adds a factor of roughly 1.2 to the linear
execution time of the native version (according to my informal benchmarks).
I realize that some current ECMAScript 3+ and most upcoming ECMAScript 4
implementations will likely be much more performant even than that.
> I for one would greatly appreciate
> > an official endorsement of these methods in ECMAScript 4. They
> certainly
> > seem to fit within the spirit of the existing ECMAScript 3 native array
> > methods (slice, splice, etc.) and have parallels in the String prototype
> > (indexOf, lastIndexOf). Is there a reason not to include them in ECMA
> 4?
> > If so, what might that be?
>
> They are included in the language.
Good news! Thank you!
-David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20070901/ddefd358/attachment-0002.html
More information about the Es4-discuss
mailing list