Skip to content

Instantly share code, notes, and snippets.

@neonstalwart
Created June 30, 2010 03:41
Show Gist options
  • Save neonstalwart/458214 to your computer and use it in GitHub Desktop.
Save neonstalwart/458214 to your computer and use it in GitHub Desktop.
var start = Date.now(),
i = 1e5,
a = [0,1,2,3,4,5,6,7,8,9],
total, l, j;
while(i--){
total = 0;
// uncomment the line you want to test
l = a.length; while(l--){ total = total + a[l]; }
//for(j = 0, l=a.length; j < l; j++){ total = total + a[j]; }
//dojo.forEach(a, function(i){ total = total + i; });
//a.forEach(function(i){total = total + i});
}
console.log(Date.now() - start);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment