Array creation with for loop vs. Array().map() (v2)

Revision 2 of this benchmark created on


Setup

const size = 100_000;

Test runner

Ready to run.

Testing in
TestOps/sec
for loop
const array = [];

for (let i = 0; i < size; i++) {
    array.push(i);
}
ready
Array().map()
const array = Array(size).map((entry, index) => index);
ready
Array().fill()
const array = Array(5).fill("new entry")
ready

Revisions

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