Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Chrome 128
Linux
Desktop
one year ago
Benchmark.js
keyBy with for loop
9.6M/s
keyBy with native reduce
8.7M/s
keyBy with forEach
5.2M/s
View exact numbers
| Test name |
Executions per second |
|
✓
map
|
25,186,712 Ops/sec |
|
keyBy with for loop
|
9,611,523 Ops/sec |
|
keyBy with native reduce
|
8,650,192 Ops/sec |
|
lodash/keyBy
|
7,013,805 Ops/sec |
|
keyBy with forEach
|
5,193,008 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop
-
map