array iteration (v106)

Revision 106 of this benchmark created on


Preparation HTML

<script>
  var i, values = [],
      sum = 0;
  for (i = 0; i < 1000; i++) {
    values[i] = i;
  }

  function add(val) {
    sum += val;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
forEach
values.forEach(add);
ready
for ++i
for (var i = 0, len = values.length; i < len; ++i) {
  add(values[i]);
}
ready
for i++
for (var i = 0, len = values.length; i < len; i++) {
  add(values[i]);
}
ready

Revisions

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