Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1
Mobile Safari 16
iOS 16.0
Mobile
2 years ago
Test name Executions per second
For Loop for item towards beginning 8500620.0 Ops/sec
While Loop for item towards beginning 8370812.5 Ops/sec
indexOf for item towards beginning 7679254.0 Ops/sec
For Loop for item towards end 6458411.5 Ops/sec
While Loop for item towards end 6343834.0 Ops/sec
indexOf for item towards end 5791253.5 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