Run details:
Mozilla/5.0 (Linux; Android 8.0.0; G8441) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36
Chrome Mobile 105
Android 8.0.0
Mobile
2 years ago
Test name Executions per second
For Loop for item towards beginning 2094818.6 Ops/sec
While Loop for item towards beginning 2085722.4 Ops/sec
indexOf for item towards beginning 2158202.2 Ops/sec
For Loop for item towards end 1766526.8 Ops/sec
While Loop for item towards end 1748309.1 Ops/sec
indexOf for item towards end 2163391.8 Ops/sec
Script Preparation code:
Tests:
  • For Loop for item towards beginning

  • While Loop for item towards beginning

  • indexOf for item towards beginning

  • For Loop for item towards end

  • While Loop for item towards end

  • indexOf for item towards end