JavaScript performance issues are complex because the different engines out there have very different performance characteristics. What is fast on one engine is slower on another.
Your closure should be very fast; after all, all functions are closures, and your self variable is defined in the context-containing context (so thereβs not much to it).
But theoretically, an engine that supports ES5 functions can optimize the operation of bind , making it even faster (there is no need even to search for one chain).
Does it matter? Not. I would use what makes sense to you. Please note that IE8 is not the only browser that does not yet have ES5 features natively (although you can always use one of the es5 gaskets, unlike some ES5 functions, bind can be perfectly emulated with gaskets in ES3 code, although they should use call to do this / apply , which may be slower than shorting on some engines).
Tj crowder
source share