Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.151 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
forEach #1 484948.2 Ops/sec
fromEntries and map #1 273936.6 Ops/sec
Object.assign and map #1 237924.0 Ops/sec
reduce #1 262838.7 Ops/sec
for 196634.7 Ops/sec
forEach #2 443567.5 Ops/sec
fromEntries and map #2 273599.1 Ops/sec
Object.assign and map #2 301097.7 Ops/sec
reduce #2 321555.8 Ops/sec
Script Preparation code:
Tests:
  • forEach #1

  • fromEntries and map #1

  • Object.assign and map #1

  • reduce #1

  • for

  • forEach #2

  • fromEntries and map #2

  • Object.assign and map #2

  • reduce #2