Tests:
  • Array.from() only

  • Array.from().map()

  • .fill("").map()

  • .fill(null).map()

  • .fill(undefined).map()

  • .fill(true).map()

  • .fill(0).map()

  • For loop

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: 11 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120 on Windows
View result in a separate tab
Test name Executions per second
Array.from() only 120050.1 Ops/sec
Array.from().map() 126393.0 Ops/sec
.fill("").map() 1114921.9 Ops/sec
.fill(null).map() 1074070.9 Ops/sec
.fill(undefined).map() 1114301.0 Ops/sec
.fill(true).map() 1127919.9 Ops/sec
.fill(0).map() 1174946.9 Ops/sec
For loop 3496883.0 Ops/sec