for loop speed i++ vs ++i (v115)

Revision 115 of this benchmark created on


Setup

var arr = [];
    for (var i = 0; i < 1000; i++) {
      arr[i] = Math.random();
    }

Test runner

Ready to run.

Testing in
TestOps/sec
i++ test
for (var i = 0, len = arr.length; i < len; i++) {
  arr[i] *= 2;
}
ready
++i test
for (var i = 0, len = arr.length; i < len; ++i) {
  arr[i] *= 2;
}
ready

Revisions

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