Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0
Firefox 122
Windows
Desktop
10 months ago
Test name Executions per second
For Loop for item towards beginning 136130144.0 Ops/sec
While Loop for item towards beginning 126719312.0 Ops/sec
indexOf for item towards beginning 57306888.0 Ops/sec
For Loop for item towards end 24834488.0 Ops/sec
While Loop for item towards end 23604978.0 Ops/sec
indexOf for item towards end 29627944.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