Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126
Linux
Desktop
2 years ago
Benchmark.js
keyBy with native reduce
4.6M/s
keyBy with for loop
3.8M/s
lodash/keyBy
3.5M/s
keyBy with forEach
2.5M/s
Native Object.groupBy
911K/s
View exact numbers
Test name Executions per second
keyBy with native reduce 4,570,380 Ops/sec
keyBy with for loop 3,770,663 Ops/sec
lodash/keyBy 3,458,310 Ops/sec
keyBy with forEach 2,530,380 Ops/sec
Native Object.groupBy 911,145 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: