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.6 Ops/sec
reduce with array mutation 11672.5 Ops/sec
flatMap 164.8 Ops/sec
for 511.7 Ops/sec
for-of 19514.8 Ops/sec
map 13334.9 Ops/sec
forEach 9711.3 Ops/sec
values (iterates over for-of) 18736.6 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)