one more thing ... I believe this will impact arrow function too since is
basically bound callbacks all over the place (or at least this is how I
believe it will be transpiled)


On Fri, Jul 12, 2013 at 4:57 PM, Andrea Giammarchi <
[email protected]> wrote:

> just to add some extra info to this discussion, lo-dash does some crazy
> thing to optimize at its best bound functions.
>
> `/\bthis\b/.test(Function.prototype.toString.call(callback))` or something
> similar to check if the function needs to use call/apply at all, together
> with the number of arguments, and some other analysis to optimize all
> further calls to the bound function.
>
> While I believe that's a bit extreme, I have to admit performance gain is
> huge so maybe some trick used in lo-dash could be used internally too ?
> Like different specialized bound version? Most common use case is still a
> method bound to the object itself in order to don't loose the context on
> some event call.
>
> my 2 cents
>
>
>
>
>
> On Fri, Jul 12, 2013 at 4:04 PM, Matthew Robb <[email protected]>wrote:
>
>> If a function proxy is just forwarding an operation through an
>> intermediary (the proxy and it's call trap) to another function it sounds
>> very similar to a regularly wrapped/bound js function. So what I am saying
>> is if browsers implemented bind using a proxy instead of the special native
>> functions it would be theoretically faster.
>>
>>
>> On Fri, Jul 12, 2013 at 2:54 PM, Allen Wirfs-Brock <[email protected]
>> > wrote:
>>
>>>
>>> On Jul 12, 2013, at 1:55 PM, Matthew Robb wrote:
>>>
>>> > In the future wouldn't using a Function Proxy be potentially much
>>> faster?
>>>
>>> It seems highly unlikely that any use of Proxy will be faster than a
>>> rough equivalent using an ordinary object.
>>>
>>> I expect proxies to be much harder for implementations to optimized than
>>> ordinary objects.
>>>
>>> Looking at it another way, if implementation haven't found it
>>> straightforward to optimize ES5 bound functions why would you expect that
>>> would have an easier time with Proxys?
>>>
>>> Allen
>>>
>>>
>>>
>>
>>
>> --
>> - Matthew Robb
>>
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to