Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:134.0) Gecko/20100101 Firefox/134.0
Firefox 134
Mac OS X 10.15
Desktop
one year ago
Benchmark.js
keyBy with for loop
32.6M/s
keyBy with native reduce
24.9M/s
keyBy with forEach
21.7M/s
View exact numbers
| Test name |
Executions per second |
|
✓
keyBy with for loop
|
32,566,044 Ops/sec |
|
keyBy with native reduce
|
24,947,900 Ops/sec |
|
keyBy with forEach
|
21,655,866 Ops/sec |
|
lodash/keyBy
|
16,774,127 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop