forEach vs loop vs while (v63)

Revision 63 of this benchmark created on


Setup

var arr = [];
    for(var i = 0; i < 100000; i++) arr[i]=i;

Test runner

Ready to run.

Testing in
TestOps/sec
forEach
arr.forEach(function(v){v;});
ready
loop
for(var i = 0, l = arr.length; i < l; i++){arr[i];}
ready
while
var h = 0;
while (h < arr.length) { arr[h++];};
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.