Script Preparation code:
AخA
 
var array1 = [];
var array2 = [];
var array3 = [];
for (let m = 0; m < 10; m++) {
  array1.push(m);
  array2.push(m + 10);
  array3.push(m + 20);
}
Tests:
  • Using array spread

     
    let array = [...array1, ...array2, ...array3];
  • Using clone and push loop

     
    let array = array1.slice();
    for (let i = 0; i < array2.length; i++) {
      array.push(array2[i]);
    }
    for (let i = 0; i < array3.length; i++) {
      array.push(array3[i]);
    }
  • Using clone and push spread

     
    let array = array1.slice();
    array.push(...array2);
    array.push(...array3);
  • Using clone and push spread 2

     
    let array = array1.slice();
    array.push(...array2, ...array3);
  • Using push spread

     
    let array = [];
    array.push(...array1, ...array2, ...array3);
  • Using array concat

     
    let array = [].concat(array1, array2, array3);
  • Using array concat (2)

     
    let array = [].concat(array1).concat(array2).concat(array3);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Using array spread
    Using clone and push loop
    Using clone and push spread
    Using clone and push spread 2
    Using push spread
    Using array concat
    Using array concat (2)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0
Firefox 113 on Linux
View result in a separate tab
Test name Executions per second
Using array spread 5324139.0 Ops/sec
Using clone and push loop 10082558.0 Ops/sec
Using clone and push spread 4393178.5 Ops/sec
Using clone and push spread 2 3553577.8 Ops/sec
Using push spread 2945258.8 Ops/sec
Using array concat 7670045.0 Ops/sec
Using array concat (2) 3492119.2 Ops/sec