Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
Edge 16.16299
Windows
Desktop
6 years ago
Test name Executions per second
indexOf first 15632979.0 Ops/sec
$.inArray first 4832321.0 Ops/sec
indexOf last 1334442.5 Ops/sec
$.inArray last 1120698.6 Ops/sec
indexOf middle 2361258.5 Ops/sec
$.inArray middle 1478231.4 Ops/sec
indexOf 825191.6 Ops/sec
$.inArray 634254.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray