Script Preparation code:
x
 
var arr = [];
var i = 0;
while (i <= 1E5) arr[i] = i++;
Tests:
  • filter().map()

     
    arr.filter(x => x % 12 && x % 5 && x % 3).map(x => x/100)
  • flatMap()

     
    arr.flatMap(x => x % 12 && x % 5 && x % 3 ? x/100 : [])
  • reduce()

     
    arr.reduce((newArray, x) => {
      if (x % 12 && x % 5 && x % 3) {
        newArray.push(x / 100)
      }
      return newArray
    }, [])
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    filter().map()
    flatMap()
    reduce()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Firefox 110 on Windows
View result in a separate tab
Test name Executions per second
filter().map() 411.7 Ops/sec
flatMap() 354.2 Ops/sec
reduce() 622.6 Ops/sec