Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Chrome 123
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
Reduce (reuse object)
1K/s
Map
852/s
forEach
805/s
Object.fromEntries
121/s
Object.assign
113/s
Reduce (creating temporary objects)
37/s
View exact numbers
Test name Executions per second
Reduce (reuse object) 1,297 Ops/sec
Map 852 Ops/sec
forEach 805 Ops/sec
Object.fromEntries 121 Ops/sec
Object.assign 113 Ops/sec
Reduce (creating temporary objects) 37 Ops/sec
Script Preparation code:
Tests: