Pimp my JS: +200% of performance
at blog.pics.io▼10 up and 2 down, posted by
10 up and 2 down, posted by
linkbait. the only optimization technique they give is
// Slow cycle
for(var i=0; i<items.length; i++) {
// code is here...
}
// this one is faster
var size = items.length;
for(var i=0;i<size; i++){
// code is here...
}
and that optimization isn't even a factor in v8 anymore because it caches `items.length`. Not sure about other engines. The latter example could still be rewritten as: for (var i=0,len=items.length; i<len; i++){ // code is here... }