Array performance

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Init array and access by index
const n = 100;
const arr = new Array(n);

for (let i = 0; i < n; i += 1) {
	arr[i] = 2*i;
}

ready
Use push method
const n = 100;
const arr = [];

for (let i = 0; i < n; i += 1) {
	arr.push(2*i);
}
ready

Revisions

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