Script Preparation code:
Tests:

Historical Performance Data aggregated from 8 community runs

Desktop Results:
Chrome 8 runs
forEach
331/s
flatMap()
247/s
filter().map()
204/s
for loop
61/s

Fastest: forEach (5.4x faster)

View exact numbers
  • forEach: 331 ops/sec
  • flatMap(): 247 ops/sec
  • filter().map(): 204 ops/sec
  • for loop: 61 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()
    for loop
    forEach

    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/135.0.0.0 Safari/537.36
Chrome 135 on Mac OS X 10.15.7
View result in a separate tab
for loop
1K/s
forEach
813/s
flatMap()
582/s
filter().map()
468/s
View exact numbers
Test name Executions per second
for loop 1,442 Ops/sec
forEach 813 Ops/sec
flatMap() 582 Ops/sec
filter().map() 468 Ops/sec