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

Revision 6 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).fill().map((entry, index) => index);
ready

Revisions

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