Script Preparation code:
AخA
 
var arr = Array(10_000).fill(0)
Tests:
  • flatMap

     
    var out = arr.flatMap(x => [x, x]);
  • forEach with push

     
    var out = [];
    arr.forEach(x => {
      out.push(x);
      out.push(x);
    });
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    flatMap
    forEach with push

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
flatMap 1265.5 Ops/sec
forEach with push 17055.1 Ops/sec