Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Linux
Desktop
2 years ago
Benchmark.js
keyBy with for loop
7.0M/s
keyBy with native reduce
6.8M/s
keyBy with forEach
3.6M/s
View exact numbers
| Test name |
Executions per second |
|
✓
keyBy with for loop
|
7,026,191 Ops/sec |
|
keyBy with native reduce
|
6,778,726 Ops/sec |
|
lodash/keyBy
|
5,132,942 Ops/sec |
|
keyBy with forEach
|
3,628,067 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop