Run details:
Mozilla/5.0 (Android 14; Mobile; rv:124.0) Gecko/124.0 Firefox/124.0
Firefox Mobile 124
Android
Mobile
8 months ago
Test name Executions per second
[...Array(n).keys()].map(k => undefined) 396.8 Ops/sec
Array.apply(null, { length: 4 }) 379.4 Ops/sec
Array.from 605.4 Ops/sec
Array(n).fill(undefined) 1959.6 Ops/sec
for loop push 1251.0 Ops/sec
Script Preparation code:
Tests:
  • [...Array(n).keys()].map(k => undefined)

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

  • Array.from

  • Array(n).fill(undefined)

  • for loop push