array for-of

Benchmark created on


Setup

class Hello {

static arr = [];

}
Hello.arr.push({a:2}, {a:3}, {a:4}, {a:5});

Test runner

Ready to run.

Testing in
TestOps/sec
for-of

let total = 0;

for (let j=0; j<1000; j++)
for (let o of Hello.arr) {
	total += o.a;	
}
ready
for loop
let total = 0;

const arr = Hello.arr;
for (let j=0; j<1000; j++)
for (let i=0, iEnd=arr.length; i<iEnd; i++) {
	total += arr[i].a;
}
ready

Revisions

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