Array init or not

Benchmark created on


Setup

const n = 100000; 
const arr0 = []; 
const arr1 = new Array(n);

Test runner

Ready to run.

Testing in
TestOps/sec
W/o pre-init
for (let i = 0; i < n; ++i)
    arr0.push(i);
ready
W/ pre-init
for (let i = 0; i < n; ++i) 
    arr1[i] = i;
ready

Revisions

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