Filling the array

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Regular creation
let a = [];
for (let i = 0; i < Math.pow(10, 3); i++) {
	a.push(i);
}
ready
Preallocation
let a = new Array(Math.pow(10, 3));
for (let i = 0; i < Math.pow(10, 3); i++) {
	a[i] = i;
}
ready

Revisions

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