Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
for-loop and object (reuse object)
7K/s
Object.fromEntries with spread
1K/s
for-loop and map
795/s
for-loop and object (creating temporary objects)
48/s
View exact numbers
Test name Executions per second
for-loop and object (reuse object) 7,329 Ops/sec
Object.fromEntries with spread 1,026 Ops/sec
for-loop and map 795 Ops/sec
for-loop and object (creating temporary objects) 48 Ops/sec
Script Preparation code:
Tests: