Script Preparation code:
x
 
function A(iterations) {
    return new Array(iterations).filter((_, idx) => idx%2 === 0).map((_, idx) => 'hi, i forgot why I am here');
}
function B(iterations) {
  const emptyArray = [];
  new Array(iterations).forEach((_, idx) => {
    if(idx%2===0) {
        emptyArray.push('hi, i forgot why I am here');
    }
  })
  return emptyArray;
}
Tests:
  • 1000 iterations

     
    A(1000);
    B(1000);
  • 1 mil

     
    A(1000000);
    B(1000000);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    1000 iterations
    1 mil

    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/113.0.0.0 Safari/537.36 Edg/113.0.1774.57
Chrome 113 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
1000 iterations 150751.8 Ops/sec
1 mil 180.9 Ops/sec