Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Chrome 117
Linux
Desktop
2 years ago
map
27K/s
values (iterates over for-of)
24K/s
for-of
24K/s
forEach
20K/s
reduce with array mutation
19K/s
for
782/s
flatMap
331/s
reduce with new array
7/s
View exact numbers
Test name Executions per second
map 27,197 Ops/sec
values (iterates over for-of) 24,433 Ops/sec
for-of 23,623 Ops/sec
forEach 19,834 Ops/sec
reduce with array mutation 19,090 Ops/sec
for 782 Ops/sec
flatMap 331 Ops/sec
reduce with new array 7 Ops/sec
Script Preparation code:
Tests: