Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15
Safari 17
Mac OS X 10.15.7
Desktop
11 months ago
Test name Executions per second
For Loop for item towards beginning 15489080.0 Ops/sec
While Loop for item towards beginning 16207099.0 Ops/sec
indexOf for item towards beginning 16913006.0 Ops/sec
For Loop for item towards end 12270232.0 Ops/sec
While Loop for item towards end 12033892.0 Ops/sec
indexOf for item towards end 15813996.0 Ops/sec
includes for item towards start 10456507.0 Ops/sec
includes for item towards end 3049818.8 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