As web pages become more and more like applications, code performance becomes more and more important. This article looks at a number of performance issues to avoid, in EcmaScript, DOM and AJAX requests. Covers eval, the with keyword, try/catch in performance-critical code, global variables, implicit object conversion, string concatenation, primitive operations over function calls, repainting and reflowing documents, modifying elements, using XPath.
Instead of creating a new XmlHttpRequest object for every request, this post provides code to pool these objects together and reuse them. This saves a great deal of processing times, particularly in IE.
Michael Mahemoff runs into a problem with Protypes $$ function when looking for class names. Its taking over 90 seconds when more than 100 matches are returned. The advice is: Avoid $$(".classname") on large DOMs.
Svend Tofte puts together a detailed guide to setting up and using the Venkman debugger. From basic debugging to watchlists and call stacks, breakpoints, and more advanced techniques like meta comments and profiling. It also contains a list of other useful Venkman resources.
A collection of performance related techniques, including temporary references (for deeply namespaced properties), optimising loops by referencing the collection length once, reasons to avoid the with syntax, using null over the delete function, comparison for equality and identity and short-circuit logical expressions