es5-array-forEach-vs-loop (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script>
var arr = [];
var x = 1000;
while (x--) arr.push(x);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
es5 forEach
arr.forEach(function (x) { x; });
ready
es5 forEach (2)
function loop(x) { x; }
arr.forEach(loop);
ready
loop
var x = arr.length;
while (x--) arr[x];
ready
for
for (var x = 1000; x > 0; x--) {
  arr[x]
}
ready

Revisions

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