Script Preparation code:
Tests:

Historical Performance Data aggregated from 252 community runs

Desktop Results:
Chrome 186 runs
flatMap()
698/s
filter().map()
572/s

Fastest: flatMap() (1.2x faster)

View exact numbers
  • flatMap(): 698 ops/sec
  • filter().map(): 572 ops/sec
Firefox 44 runs
filter().map()
756/s
flatMap()
676/s

Fastest: filter().map() (1.1x faster)

View exact numbers
  • filter().map(): 756 ops/sec
  • flatMap(): 676 ops/sec
Safari 9 runs
flatMap()
2K/s
filter().map()
960/s

Fastest: flatMap() (1.9x faster)

View exact numbers
  • flatMap(): 1,867 ops/sec
  • filter().map(): 960 ops/sec
Other 5 runs
filter().map()
459/s
flatMap()
231/s

Fastest: filter().map() (2.0x faster)

View exact numbers
  • filter().map(): 459 ops/sec
  • flatMap(): 231 ops/sec
Mobile Results:
Safari 8 runs
filter().map()
3K/s
flatMap()
2K/s

Fastest: filter().map() (1.3x faster)

View exact numbers
  • filter().map(): 2,839 ops/sec
  • flatMap(): 2,251 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    filter().map()
    flatMap()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0
Chrome 147 on Windows
View result in a separate tab
flatMap()
1K/s
filter().map()
869/s
View exact numbers
Test name Executions per second
flatMap() 1,001 Ops/sec
filter().map() 869 Ops/sec