forEach vs loop (v91)

Revision 91 of this benchmark created on


Description

Better test body

Setup

var arr = [];
    for (var i = 0; i < 100000; i++) arr[i] = i;
    var fn = function(v) {
      v++;
    }

Test runner

Ready to run.

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

Revisions

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