Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Chrome 124
Windows
Desktop
6 months ago
Test name Executions per second
Array.apply(null, Array(n)) 266123.8 Ops/sec
[...Array(n)] 466883.6 Ops/sec
Array(n).fill(null) 405557.8 Ops/sec
Array.from({ length: n }) 39648.2 Ops/sec
Array.from({ length:n }, (item, i) => i) 36705.4 Ops/sec
Tests:
  • Array.apply(null, Array(n))

  • [...Array(n)]

  • Array(n).fill(null)

  • Array.from({ length: n })

  • Array.from({ length:n }, (item, i) => i)


;