Create empty or sized array

Benchmark created on


Setup

const repetitions = 0;

Teardown

array.length = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
Empty array
const array = [];

for (let i = 0; i < repetitions; i++) {
	array.push(i);
}
ready
Initialize array size
const array = new Array(repetitions);

for (let i = 0; i < repetitions; i++) {
	array[i] = i;
}
ready

Revisions

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