Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0
Firefox 121
Linux
Desktop
2 years ago
Benchmark.js
keyBy with for loop
31.4M/s
keyBy with native reduce
22.5M/s
keyBy with forEach
17.0M/s
View exact numbers
| Test name |
Executions per second |
|
✓
keyBy with for loop
|
31,424,796 Ops/sec |
|
keyBy with native reduce
|
22,529,296 Ops/sec |
|
lodash/keyBy
|
17,912,412 Ops/sec |
|
keyBy with forEach
|
16,961,236 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop