Script Preparation code:
x
 
var array1 = Array(400).fill().map(() => Math.round(Math.random() * 40));
var array2 = Array(400).fill().map(() => Math.round(Math.random() * 40));
var array3 = Array(400).fill().map(() => Math.round(Math.random() * 40));
var array4 = Array(400).fill().map(() => Math.round(Math.random() * 40));
var array5 = Array(400).fill().map(() => Math.round(Math.random() * 40));
var allArrays = [array1, array2, array3, array4, array5];
Tests:
  • array.apply

     
    var others = [].concat.apply([], allArrays);
  • array.flat()

     
    var others = allArrays.flat()
  • array.reduce

     
    var others = allArrays.reduce(((combinedLength, label) => combinedLength + label.length), 0)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    array.apply
    array.flat()
    array.reduce

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1
Mobile Safari 15 on iOS 15.4.1
View result in a separate tab
Test name Executions per second
array.apply 201445.0 Ops/sec
array.flat() 25738.5 Ops/sec
array.reduce 10768165.0 Ops/sec