Run details:
Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0
Firefox 52
Windows XP
Desktop
4 months ago
Test name Executions per second
Simple for loop - Access index and value 234033.3 Ops/sec
Array.forEach - Access index and value 180378.6 Ops/sec
for-of + Array.entries 3078.7 Ops/sec
for-of - Access value only 13891.4 Ops/sec
Simple for loop - Access value only 256694.8 Ops/sec
Array.forEach - Access value only 176127.2 Ops/sec
Script Preparation code:
Tests:
  • Simple for loop - Access index and value

  • Array.forEach - Access index and value

  • for-of + Array.entries

  • for-of - Access value only

  • Simple for loop - Access value only

  • Array.forEach - Access value only