Function.bind() performance vs native

171 views
Skip to first unread message

Jason

unread,
Jun 3, 2013, 5:44:07 PM6/3/13
to prototype-s...@googlegroups.com

ECMA 5 introduced Function.prototype.bind() which is similar to the PrototypeJS version that binds the context to the function. In a class scope you can bind the "this" variable in the function scope to the "this" of the class.

Here is a performance test between those 2


Higher numbers are better as that is the number of operations per second and the native bind() method is higher?

Anyone have any insight?

Thanks all!

Walter Lee Davis

unread,
Jun 3, 2013, 8:06:31 PM6/3/13
to prototype-s...@googlegroups.com
I believe that the plan all along w/r/t these new JS-core features has been to prefer the native implementation where available and compatible, and leave the Prototype method as a polyfill for older browsers. I don't believe that Prototype currently behaves this way, but the last time I heard anything "official" on this list about the future of Prototype, that was one of the things mentioned.

BTW, what browser were you using when you tested this? In Safari.latest Mac OS X, I see Prototype winning, and native 17% slower.

Walter
> --
> You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prototype-scripta...@googlegroups.com.
> To post to this group, send email to prototype-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Jason Westbrook

unread,
Jun 3, 2013, 9:47:59 PM6/3/13
to prototype-s...@googlegroups.com
Chrome on OSX with Prototype winning as well - I was just curious as to why the native implementation is slower than the Prototype implementation?

Jason Westbrook | T: 313-799-3770 | jwest...@gmail.com
Reply all
Reply to author
Forward
0 new messages