Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Chrome 79
Linux
Desktop
4 years ago
Test name Executions per second
forEach #1 284737.5 Ops/sec
fromEntries and map #1 198270.5 Ops/sec
Object.assign and map #1 195942.8 Ops/sec
reduce #1 194444.0 Ops/sec
for 161788.5 Ops/sec
forEach #2 339482.9 Ops/sec
fromEntries and map #2 187782.9 Ops/sec
Object.assign and map #2 188364.0 Ops/sec
reduce #2 199831.9 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