for each vs for loop (v112)

Revision 112 of this benchmark created on


Description

Better test body

Setup

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

Test runner

Ready to run.

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

Revisions

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