Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0
Firefox 89
Mac OS X 10.15
Desktop
3 years ago
Test name Executions per second
reduce with forEach 1857.1 Ops/sec
flatMap 1363.2 Ops/sec
reduce with forEach (directly) 647.8 Ops/sec
flat 1454.4 Ops/sec
reduce with apply 708.3 Ops/sec
for with foreach 427.3 Ops/sec
for with apply 714.9 Ops/sec
nested for 2040.7 Ops/sec
reduce with while 3464.1 Ops/sec
while with foreach 419.4 Ops/sec
while with apply 724.9 Ops/sec
while with for 2017.6 Ops/sec
nested while 3884.6 Ops/sec
nested reduce 1215.3 Ops/sec
Script Preparation code:
Tests:
  • reduce with forEach

  • flatMap

  • reduce with forEach (directly)

  • flat

  • reduce with apply

  • for with foreach

  • for with apply

  • nested for

  • reduce with while

  • while with foreach

  • while with apply

  • while with for

  • nested while

  • nested reduce