Test (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Test
const a = {
	array: []
};

for (let i; i < 1000000; i++) {
	a.array.push([1,2,3, [1,2,3]]);
}

function add(ref) {
	return ref[0] + ref[1] + ref[2] + (ref[3]) ? add(ref[3]) : 0;
}

for (let i; i < a.array.length; i++) {
	add(a.array[i]);
}
ready
Test
const a = {
	a1: [],
	a2: [],
	a3: []
};

for (let i; i < 1000000; i++) {
	a.a1.push(1);
	a.a2.push(2);
	a.a3.push(3);
}

function add(a, b, c, stop = false) {
	return a + b + c + (!stop) ? add(a,b,c, true) : 0;
}

for (let i; i < a.a1.length; i++) {
	add(a.a1[i], a.a2[i], a.a3[i]);
}
ready

Revisions

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