Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
Custom implementation
4K/s
Reduce (reuse object)
3K/s
Map
2K/s
Object.fromEntries
334/s
Reduce (creating temporary objects)
109/s
View exact numbers
Test name Executions per second
Custom implementation 3,657 Ops/sec
Reduce (reuse object) 3,167 Ops/sec
Map 1,894 Ops/sec
Object.fromEntries 334 Ops/sec
Reduce (creating temporary objects) 109 Ops/sec
Script Preparation code:
Tests: