Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
forEach #1 707572.9 Ops/sec
fromEntries and map #1 395753.2 Ops/sec
Object.assign and map #1 341534.9 Ops/sec
reduce #1 386661.4 Ops/sec
for 345229.7 Ops/sec
forEach #2 761157.1 Ops/sec
fromEntries and map #2 384676.1 Ops/sec
Object.assign and map #2 375230.9 Ops/sec
reduce #2 385338.3 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