HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 6 community runs

Desktop Results:
Chrome 6 runs
for loop pre-allocate cached length
263K/s
for loop pre-allocate
210K/s
for loop push
185K/s
Array.from with map
84K/s
Spread with map
81K/s
Array.from with second parameter
78K/s

Fastest: for loop pre-allocate cached length (3.4x faster)

View exact numbers
  • for loop pre-allocate cached length: 263,019 ops/sec
  • for loop pre-allocate: 209,618 ops/sec
  • for loop push: 184,689 ops/sec
  • Array.from with map: 83,830 ops/sec
  • Spread with map: 80,834 ops/sec
  • Array.from with second parameter: 78,247 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Spread with map
    Array.from with map
    Array.from with second parameter
    for loop push
    for loop pre-allocate
    for loop pre-allocate cached length

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0
Firefox 141 on Windows
View result in a separate tab
for loop pre-allocate cached length
551K/s
Array.from with second parameter
407K/s
Spread with map
405K/s
for loop pre-allocate
384K/s
Array.from with map
383K/s
for loop push
367K/s
View exact numbers
Test name Executions per second
for loop pre-allocate cached length 551,054 Ops/sec
Array.from with second parameter 407,040 Ops/sec
Spread with map 404,565 Ops/sec
for loop pre-allocate 383,677 Ops/sec
Array.from with map 383,415 Ops/sec
for loop push 367,298 Ops/sec