Array Iteration (v39)

Revision 39 of this benchmark created on


Description

Compare iterating forward or backwards of an array

Setup

var arr = [];
    for (var i = 0; i < 10000; ++i) {
      arr.push(1);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
forwards
for (var len = arr.length, var i = 0; i < len; ++i) {;
}
ready
backwards
for (var i = arr.length - 1; i >= 0; --i) {;
}
ready
Hard Coded Forward
for (var i = 0; i < 10000; ++i) {;
}
ready
Cached Forward Iteration
for (var i = 0, c = arr.length; i < c; i++) {

}
ready
cached forward 2
var c = arr.length
for (var i = 0; i < c; i++) {

}
ready

Revisions

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