News for hackers. Stuff that matters.
Re:How to write up to 98% faster JavaScript code. by poink on Friday April 15, 2011 @04:19PM (#2452045)
Object property lookups aren't free. The 'global namespace chain' code has to lookup the util property in the Library object, then the add function in the util object.

It's not particularly expensive, but if you do it in a tight loop 100k times it'll look slow compared to something that doesn't need to do that work.

As others have said, the trick is simply to perform those lookups earlier and assign the resulting function/data to a variable.

Re:How to write up to 98% faster JavaScript code. by daniel1980fl on Friday April 15, 2011 @04:32PM (#2452082)
I love JavaScript!!

I have no idea how boring and where dynamic web-paging would be today without JS!