Tests:

Historical Performance Data aggregated from 210 community runs

Desktop Results:
Chrome 148 runs
Set length to zero
41K/s
Just instantiate new array
41K/s
Splice
37K/s
Pop all values
25K/s

Fastest: Set length to zero (1.7x faster)

View exact numbers
  • Set length to zero: 41,218 ops/sec
  • Just instantiate new array: 41,122 ops/sec
  • Splice: 36,972 ops/sec
  • Pop all values: 24,637 ops/sec
Firefox 42 runs
Splice
31K/s
Set length to zero
31K/s
Just instantiate new array
27K/s
Pop all values
16K/s

Fastest: Splice (2.0x faster)

View exact numbers
  • Splice: 31,435 ops/sec
  • Set length to zero: 31,245 ops/sec
  • Just instantiate new array: 27,302 ops/sec
  • Pop all values: 15,633 ops/sec
Mobile Results:
Chrome 13 runs
Just instantiate new array
15K/s
Set length to zero
15K/s
Splice
14K/s
Pop all values
10K/s

Fastest: Just instantiate new array (1.6x faster)

View exact numbers
  • Just instantiate new array: 15,166 ops/sec
  • Set length to zero: 15,027 ops/sec
  • Splice: 13,750 ops/sec
  • Pop all values: 9,548 ops/sec
Safari 7 runs
Set length to zero
40K/s
Just instantiate new array
40K/s
Splice
39K/s
Pop all values
23K/s

Fastest: Set length to zero (1.8x faster)

View exact numbers
  • Set length to zero: 40,135 ops/sec
  • Just instantiate new array: 40,085 ops/sec
  • Splice: 38,903 ops/sec
  • Pop all values: 22,867 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
    Just instantiate new array
    Set length to zero
    Splice
    Pop all values

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 16 days ago)
Mozilla/5.0 (X11; Linux x86_64; rv:154.0) Gecko/20100101 Firefox/154.0
Firefox 154 on Linux
View result in a separate tab
Just instantiate new array
25K/s
Set length to zero
24K/s
Splice
23K/s
Pop all values
12K/s
View exact numbers
Test name Executions per second
Just instantiate new array 24,656 Ops/sec
Set length to zero 23,997 Ops/sec
Splice 23,395 Ops/sec
Pop all values 12,434 Ops/sec