Tests:
  • Array.from(new Array(length), () => new Array(length))

  • Array.from({length}, () => new Array(length))

  • for push

  • for index

  • Array.from(Array(length), () => new Array(length))

  • for push set size

  • for index set size

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Array.from(new Array(length), () => new Array(length))
    Array.from({length}, () => new Array(length))
    for push
    for index
    Array.from(Array(length), () => new Array(length))
    for push set size
    for index set size

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 7 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109 on Windows
View result in a separate tab
Test name Executions per second
Array.from(new Array(length), () => new Array(length)) 160453.8 Ops/sec
Array.from({length}, () => new Array(length)) 150472.2 Ops/sec
for push 227218.6 Ops/sec
for index 239894.0 Ops/sec
Array.from(Array(length), () => new Array(length)) 161594.3 Ops/sec
for push set size 221498.6 Ops/sec
for index set size 233617.0 Ops/sec


;