Script Preparation code:
AخA
 
// Create an array of 1000 random intergers between 1 and 10000
var arrRandom = [];
for(var intCtr=0; intCtr<1000; intCtr++) {
  arrRandom.push(Math.floor(Math.random() * Math.floor(10000)));
}
Tests:
  • reduce

     
    arrRandom.reduce((acc, v) => (acc.push(v), acc), [])
  • for loop

     
    arrRandom.reduce((acc, v) => ([...acc, v]), [])
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    reduce
    for loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36
Chrome 92 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
reduce 305178.3 Ops/sec
for loop 2033.3 Ops/sec