Script Preparation code:
Tests:

Historical Performance Data aggregated from 6 community runs

Desktop Results:
Chrome 6 runs
Slice with begin argument
91.4M/s
Array.slice
87.6M/s
Array.concat
60.7M/s
Spread operator
54.1M/s
Slice with begin and end argument
24.0M/s
While loop
2.2M/s
For loop with declared length
2.1M/s
For loop
1.9M/s

Fastest: Slice with begin argument (47.8x faster)

View exact numbers
  • Slice with begin argument: 91,431,088 ops/sec
  • Array.slice: 87,552,624 ops/sec
  • Array.concat: 60,654,792 ops/sec
  • Spread operator: 54,130,476 ops/sec
  • Slice with begin and end argument: 24,002,996 ops/sec
  • While loop: 2,152,768 ops/sec
  • For loop with declared length: 2,111,465 ops/sec
  • For loop: 1,914,440 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
    Array.concat
    Array.slice
    For loop
    For loop with declared length
    While loop
    Spread operator
    Slice with begin argument
    Slice with begin and end argument

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:150.0) Gecko/20100101 Firefox/150.0
Firefox 150 on Mac OS X 10.15
View result in a separate tab
Array.slice
33.0M/s
Slice with begin argument
32.9M/s
Slice with begin and end argument
32.8M/s
Array.concat
24.3M/s
While loop
15.1M/s
For loop with declared length
14.7M/s
For loop
14.4M/s
Spread operator
6.4M/s
View exact numbers
Test name Executions per second
Array.slice 32,993,010 Ops/sec
Slice with begin argument 32,890,174 Ops/sec
Slice with begin and end argument 32,798,278 Ops/sec
Array.concat 24,338,184 Ops/sec
While loop 15,078,051 Ops/sec
For loop with declared length 14,727,930 Ops/sec
For loop 14,429,202 Ops/sec
Spread operator 6,426,543 Ops/sec