Hacker News new | ask | show | jobs
by ehynds 5537 days ago
That's why you cache methods to reduce lookups.

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.

1 comments

Doesn't Google Compiler do this for you?