Run details:
Mozilla/5.0 (Linux; Android 13; M2012K11AG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Mobile Safari/537.36
Chrome Mobile 104
Android
Mobile
9 months ago
Test name Executions per second
For Loop for item towards beginning 4782530.5 Ops/sec
While Loop for item towards beginning 4718327.0 Ops/sec
indexOf for item towards beginning 4916440.5 Ops/sec
For Loop for item towards end 4125821.0 Ops/sec
While Loop for item towards end 4152505.8 Ops/sec
indexOf for item towards end 5005071.5 Ops/sec
includes for item towards start 5014884.0 Ops/sec
includes for item towards end 5006549.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

  • includes for item towards start

  • includes for item towards end