Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/120.0.6099.119 Mobile/15E148 Safari/604.1
Chrome Mobile iOS 120
iOS 17.2
Mobile
2 years ago
Benchmark.js
keyBy with for loop
11.2M/s
keyBy with native reduce
9.9M/s
keyBy with forEach
5.6M/s
View exact numbers
| Test name |
Executions per second |
|
✓
keyBy with for loop
|
11,173,351 Ops/sec |
|
keyBy with native reduce
|
9,911,724 Ops/sec |
|
lodash/keyBy
|
8,893,634 Ops/sec |
|
keyBy with forEach
|
5,618,071 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop