Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
Chrome 101
Linux
Desktop
2 years ago
Test name Executions per second
reduce with new array 6.4 Ops/sec
reduce with array mutation 9295.3 Ops/sec
flatMap 147.6 Ops/sec
for 519.5 Ops/sec
for-of 19130.2 Ops/sec
map 14065.7 Ops/sec
forEach 9213.4 Ops/sec
values (iterates over for-of) 18531.8 Ops/sec
Script Preparation code:
Tests:
  • reduce with new array

  • reduce with array mutation

  • flatMap

  • for

  • for-of

  • map

  • forEach

  • values (iterates over for-of)