6 ms·
That's why you cache methods to reduce lookups. http://jsperf.com/global-namespace-chain-vs-string-based-local-modules/3 http://jsperf.com/global-namespace-cha
by ehynds 15y ago
That's why you cache methods to reduce lookups.
http://jsperf.com/global-namespace-chain-vs-string-based-local-modules/3 http://jsperf.com/global-namespace-chain-vs-string-based-loc...
In your tests the method "add" is pretty far away from it's original variable, and MUCH further away than any jQuery method is, so you're also testing the time it takes to lookup that method. In jQuery, methods are either attached to "jQuery" directly or on the prototype.
- Hipchan 15y agoDoesn't Google Compiler do this for you?