Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 OPR/125.0.0.0
Opera 125
Windows
Desktop
8 months ago
Benchmark.js
keyBy with for loop
12.1M/s
keyBy with native reduce
10.9M/s
keyBy with forEach
8.1M/s
View exact numbers
| Test name |
Executions per second |
|
✓
keyBy with for loop
|
12,123,915 Ops/sec |
|
keyBy with native reduce
|
10,934,256 Ops/sec |
|
lodash/keyBy
|
8,428,498 Ops/sec |
|
keyBy with forEach
|
8,135,852 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop