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)
3K/s
forEach
2K/s
Map
2K/s
Object.fromEntries
301/s
Object.assign
172/s
Reduce (creating temporary objects)
121/s
View exact numbers
Test name Executions per second
Reduce (reuse object) 3,404 Ops/sec
forEach 2,223 Ops/sec
Map 2,186 Ops/sec
Object.fromEntries 301 Ops/sec
Object.assign 172 Ops/sec
Reduce (creating temporary objects) 121 Ops/sec
Script Preparation code:
Tests: