Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Chrome 106
Linux
Desktop
2 years ago
Test name Executions per second
Array.map with Object.fromEntries 942.2 Ops/sec
Array.map with new Map 916.1 Ops/sec
Reduce with new Object (`{}`) (reusing object) 4037.8 Ops/sec
Reduce with new Object (`{}`) (creating temporary objects) 37.3 Ops/sec
Reduce with new Map (reusing map) 1158.3 Ops/sec
Script Preparation code:
Tests:
  • Array.map with Object.fromEntries

  • Array.map with new Map

  • Reduce with new Object (`{}`) (reusing object)

  • Reduce with new Object (`{}`) (creating temporary objects)

  • Reduce with new Map (reusing map)