Ah, the array extras use pass the second argument on to 
Function.prototype.call. That would indeed be faster. I thought bind() was 
used, but that makes no sense.

On Oct 25, 2011, at 0:23 , Brendan Eich 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

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to