Run details:
Mozilla/5.0 (Linux; Android 11; GM1913) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36
Chrome Mobile 90
Android
Mobile
3 years ago
Test name Executions per second
For Loop for item towards beginning 4866062.5 Ops/sec
While Loop for item towards beginning 4882272.0 Ops/sec
indexOf for item towards beginning 5177166.5 Ops/sec
For Loop for item towards end 3951958.2 Ops/sec
While Loop for item towards end 3940427.0 Ops/sec
indexOf for item towards end 5133776.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