Entries tagged ‘optimizing’

Optimizations

posted December 13th, 2005, 10 comments, tagged ,

When optimizing, you have to make sure it actually helps. In this case, not really. You’re lucky to see a one millisecond difference on a thousand function calls (in Firefox 1.5 on Mac, at least).

Update (a few minutes after the fact): I realized that Deans function checks for the existence of a property on a node. This lookup could cost more time, so I updated the test case to make sure the if/else clause looked up two properties on the document node. Differences now are 10 – 20 ms (still not very much as we are talking about a thousand invocations).

Update (December 13th, 11 pm): Updated test with Sjoerds suggestions. More interesting results in the comments.