Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Mac OS X 10.12.6
Desktop
6 years ago
Test name Executions per second
indexOf first 9990614.0 Ops/sec
$.inArray first 2375585.5 Ops/sec
indexOf last 9948348.0 Ops/sec
$.inArray last 396259.8 Ops/sec
indexOf middle 9920662.0 Ops/sec
$.inArray middle 679200.0 Ops/sec
indexOf 3300809.8 Ops/sec
$.inArray 229330.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray