Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
Firefox 131
Windows
Desktop
2 months ago
Test name Executions per second
For Loop for item towards beginning 316366112.0 Ops/sec
While Loop for item towards beginning 314362784.0 Ops/sec
indexOf for item towards beginning 102592512.0 Ops/sec
For Loop for item towards end 32239878.0 Ops/sec
While Loop for item towards end 31476410.0 Ops/sec
indexOf for item towards end 46944548.0 Ops/sec
includes for item towards start 93323480.0 Ops/sec
includes for item towards end 50754884.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