Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85
Mac OS X 10.15.6
Desktop
4 years ago
Test name Executions per second
For Loop for item towards beginning 5606290.0 Ops/sec
While Loop for item towards beginning 5869605.0 Ops/sec
indexOf for item towards beginning 6366454.0 Ops/sec
For Loop for item towards end 4996906.0 Ops/sec
While Loop for item towards end 4820806.5 Ops/sec
indexOf for item towards end 6131702.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