Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0
Chrome 125
Windows
Desktop
6 months ago
Test name Executions per second
For Loop for item towards beginning 6453813.5 Ops/sec
While Loop for item towards beginning 6551952.0 Ops/sec
indexOf for item towards beginning 6311247.5 Ops/sec
For Loop for item towards end 5738056.0 Ops/sec
While Loop for item towards end 5602068.5 Ops/sec
indexOf for item towards end 5225418.0 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