Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119
Windows
Desktop
2 years ago
Benchmark.js
keyBy with for loop
6.2M/s
keyBy with native reduce
6.0M/s
keyBy with forEach
3.1M/s
View exact numbers
| Test name |
Executions per second |
|
✓
keyBy with for loop
|
6,185,646 Ops/sec |
|
keyBy with native reduce
|
6,030,011 Ops/sec |
|
lodash/keyBy
|
4,455,160 Ops/sec |
|
keyBy with forEach
|
3,077,899 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop