forEach vs reduce vs map vs filter vs for

23 days ago
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Test name Executions per second
forEach 698.1 Ops/sec
reduce 679.1 Ops/sec
map 662.0 Ops/sec
filter 642.7 Ops/sec
for 559.0 Ops/sec
Script Preparation code:
Tests:
  • forEach

  • reduce

  • map

  • filter

  • for

Open this result on MeasureThat.net