forEach vs reduce vs map vs filter vs for

one month ago
User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Test name Executions per second
forEach 215.4 Ops/sec
reduce 216.3 Ops/sec
map 205.5 Ops/sec
filter 204.8 Ops/sec
for 163.2 Ops/sec
Script Preparation code:
Tests:
  • forEach

  • reduce

  • map

  • filter

  • for

Open this result on MeasureThat.net