demonstrated here indeed:
http://jsperf.com/array-extras-second-argument

on average, closures plus scope lookup looks always slower but I'll add more
tests.

On Tue, Oct 25, 2011 at 12:23 AM, Brendan Eich <bren...@mozilla.com> wrote:

> On Oct 24, 2011, at 2:53 PM, Axel Rauschmayer wrote:
>
> > that = this:
> > - Your point is that forEach() and map() have a second parameter that
> allows you to hand in a value for "this", right?
> >    => I have yet to find a clear argument in favor or against using that
> = this here. Both solutions have performance implications, both solutions
> add an extra line. that = this has two extra tokens, but adding a second
> argument looks awkward.
>
> We're talking about performance, not "looks". Passing trailing |this|
> parameters to the Array extras avoids allocation (bound object or closure)
> per extra application.
>
> /be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to