Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36
Chrome 91
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
forEach #1 802999.3 Ops/sec
fromEntries and map #1 458306.5 Ops/sec
Object.assign and map #1 392947.1 Ops/sec
reduce #1 372010.0 Ops/sec
for 380507.8 Ops/sec
forEach #2 559564.3 Ops/sec
fromEntries and map #2 484553.1 Ops/sec
Object.assign and map #2 431921.1 Ops/sec
reduce #2 484162.6 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