Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Firefox/128.0
Firefox 128
Mac OS X 10.15
Desktop
5 months ago
Test name Executions per second
Simple for loop - Access index and value 1479458.0 Ops/sec
Array.forEach - Access index and value 323023.2 Ops/sec
for-of + Array.entries 184823.1 Ops/sec
for-of - Access value only 455429.9 Ops/sec
Simple for loop - Access value only 1574334.2 Ops/sec
Array.forEach - Access value only 339642.1 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