xyz

Benchmark created on


Setup

let count = 1_000_000;
let a = [];
let b = new Int32Array(count * 2);

for (let i = 0; i < count; i++) {
	a.push({x: 11 * i, y: i / 6});
}

for (let i = 0; i < b.length; i += 2) {
	b[i] = 11 * i;
	b[i + 1] = i / 6;
}

Test runner

Ready to run.

Testing in
TestOps/sec
array of objects
for (let i = 0; i < a.length; i++) {
	a[i].x--;
	a[i].y++;
}
ready
packed int32
for (let i = 0; i < b.length; i += 2) {
	b[i]--;
	b[i + 1]++;
}
ready

Revisions

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