Run details:
Mozilla/5.0 (Linux; Android 8.0.0; ATU-L22) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Mobile Safari/537.36
Chrome Mobile 93
Android 8.0.0
Mobile
2 years ago
Test name Executions per second
For Loop for item towards beginning 448841.0 Ops/sec
While Loop for item towards beginning 452509.3 Ops/sec
indexOf for item towards beginning 463779.6 Ops/sec
For Loop for item towards end 385291.7 Ops/sec
While Loop for item towards end 401306.2 Ops/sec
indexOf for item towards end 490498.1 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