Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0
Firefox 113
Ubuntu
Desktop
2 years ago
Benchmark.js
keyBy with for loop
11.1M/s
keyBy with native reduce
8.0M/s
keyBy with forEach
5.1M/s
View exact numbers
| Test name |
Executions per second |
|
✓
keyBy with for loop
|
11,132,635 Ops/sec |
|
keyBy with native reduce
|
8,011,558 Ops/sec |
|
lodash/keyBy
|
5,556,575 Ops/sec |
|
keyBy with forEach
|
5,085,608 Ops/sec |
Tests:
-
lodash/keyBy
-
keyBy with native reduce
-
keyBy with forEach
-
keyBy with for loop