Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Firefox 133
Linux
Desktop
one month ago
Test name Executions per second
For Loop for item towards beginning 71667448.0 Ops/sec
While Loop for item towards beginning 72112056.0 Ops/sec
indexOf for item towards beginning 29995712.0 Ops/sec
For Loop for item towards end 12597550.0 Ops/sec
While Loop for item towards end 12551132.0 Ops/sec
indexOf for item towards end 16152632.0 Ops/sec
includes for item towards start 25117074.0 Ops/sec
includes for item towards end 14644583.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