.optimize(performance)
Andy Lindemann • @andymensional
or websites like jsperf.com
Profiling using
console.profile(name)
and
console.profileEnd(name)
or Developer Tools profiling tab
Using the Developer Tools timeline can also be useful
console.time('fibonacci');
var fibo = [0,1], index = 0;
while(++index < 100000){
fibo.push(fibo[index] + fibo[index-1]);
}
console.timeEnd('fibonacci');
Declare variables and functions where you need them
to avoid scope traversal.
Declare local references for frequently used objects
or their fields and functions.
jsperf link tbd