array for-of (v4)

Revision 4 of this benchmark created on


Setup

class Hello {
static a = [];
static b = [];
static arr = [];
static c = [];
static d = [];
}
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++)
{
	const arr = Hello.arr;
    for (let o of arr) {
	   total += o.a;	
    }
}
ready
for loop
let total = 0;
for (let j=0; j<1000; j++)
{
    const arr = Hello.arr;
    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.