it must be said the pattern I chose to bring more references ( e.g. the
object with .s and .t ) looks slower on average but I am big fun of code
reusability so I would say two or more functions that brings same references
through the object in order to perform same operations could be summarized
as single one ( kinda edge case though )

If only two references I would still prefer the "this" approach for one of
them rather than a lookup for both but for all other cases I said long time
ago this trend to create a new closure rather than use the second argument
of Array extras could not bring any advantage for both reusability and, now
demonstrated, performances.

It was nice to test it in any case so thanks.

br,
    Andrea Giammarchi

On Tue, Oct 25, 2011 at 12:32 AM, Axel Rauschmayer <a...@rauschma.de> wrote:

> 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
> a...@rauschma.de
>
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
>
>
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to