Array loop with len var (v114)

Revision 114 of this benchmark created on


Setup

var arr = [],
        i,
        obj = {};
    for(i = 0; i < 10000; i += 1) {
        var o = {payload:i};
        arr.push(o);
        obj[i] = o;
    }

Test runner

Ready to run.

Testing in WebKit 537.36 / undefined
TestOps/sec
Without var len
var sum = 0;
for (var x=0; x<arr.length; ++x) {
    sum += arr[x].payload
}
ready
With var len
var sum = 0;
var len= arr.length;
for (var x=0; x<len; ++x) {
    sum += arr[x].payload
}
ready

Revisions

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