Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Firefox 133
Windows
Desktop
4 months ago
Test name Executions per second
[...Array(n).keys()].map(filler) 622.7 Ops/sec
Array.apply(null, { length: 4 }).map(filler) 398.9 Ops/sec
Array.from 999.2 Ops/sec
Array(n).fill(undefined).map(filler) 755.9 Ops/sec
for loop push 2903.7 Ops/sec
Script Preparation code:
Tests:
  • [...Array(n).keys()].map(filler)

  • Array.apply(null, { length: 4 }).map(filler)

  • Array.from

  • Array(n).fill(undefined).map(filler)

  • for loop push