Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0
Firefox 148
Linux
Desktop
4 months ago
Array(n).fill(undefined)
2K/s
for loop push
792/s
Array.from
720/s
[...Array(n).keys()].map(k => undefined)
349/s
Array.apply(null, { length: 4 })
269/s
View exact numbers
Test name Executions per second
Array(n).fill(undefined) 2,122 Ops/sec
for loop push 792 Ops/sec
Array.from 720 Ops/sec
[...Array(n).keys()].map(k => undefined) 349 Ops/sec
Array.apply(null, { length: 4 }) 269 Ops/sec
Script Preparation code:
Tests: