Smashing magazine posted a Seven Must-See Videos and Presentations for Web App Developers
finally had the chance to start watching these videos(on the bus :))
Very interesting talk:
While watching this remember that you should take the problematic places that need to perform better and make the changes there(as Nicholas also stated at the beginning of the talk and also in this post following the talk).
I think that performance should also guide us while writing the code,
BUT in most cases – the alternative that uses code that is a bit slower(say using jQuery that makes using closures very easy) – is more readable and maintainable and should be used.
here are some of my notes(for me.. you shuold just watch it)
* mind your scope, minimizing the scope chain is better(don't use with, try/catch)
* try to use less closures
* property accessing is costly(store it at a var in the function)
* don't use for-in for itertating arrays
* shorten loops and the amount of work in each step
for(var i=0, len=values.length ;i<len;i++)
//flip loops (50% less time)
$.each(function… – this creates a closure for each iteration – use regular loop if you can
* HTMLCollections – BAD – and are evaluated always(sort of live objects)
if you need to access it frequently – copy it to an array.
* eliminate Reflow(when adding items to a dom list for example)
* use DocumentFragment as a container document.createDocumentFragment- and then add this to the dom.
* do dom manipulations outside of the dom
* don't touch the style a lot – define a class instead that contains all of these if possible