es5-array-forEach-vs-loop

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
loop
var x = arr.length;
while (x--) arr[x];
ready

Revisions

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