Tests:
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Array.from() only
    Array.from().map()
    .fill("").map()
    .fill(null).map()
    .fill(undefined).map()
    .fill(true).map()
    .fill(0).map()
    For loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Chrome 138 on Mac OS X 10.15.7
View result in a separate tab
For loop
37.1M/s
.fill(0).map()
4.7M/s
.fill("").map()
4.3M/s
.fill(undefined).map()
4.3M/s
.fill(true).map()
4.2M/s
.fill(null).map()
4.2M/s
Array.from().map()
439K/s
Array.from() only
393K/s
View exact numbers
Test name Executions per second
For loop 37,116,912 Ops/sec
.fill(0).map() 4,714,552 Ops/sec
.fill("").map() 4,258,787 Ops/sec
.fill(undefined).map() 4,257,582 Ops/sec
.fill(true).map() 4,243,179 Ops/sec
.fill(null).map() 4,221,850 Ops/sec
Array.from().map() 438,687 Ops/sec
Array.from() only 392,602 Ops/sec