Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Chrome 78
Mac OS X 10.15.1
Desktop
5 years ago
Test name Executions per second
for - create new array 5484.1 Ops/sec
forEach - create new array 6951.1 Ops/sec
map - create new array 8366.6 Ops/sec
for - overwrite array 4400.2 Ops/sec
forEach - overwrite array 5791.8 Ops/sec
map - overwrite array 7969.6 Ops/sec
Script Preparation code:
Tests:
  • for - create new array

  • forEach - create new array

  • map - create new array

  • for - overwrite array

  • forEach - overwrite array

  • map - overwrite array