Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Mac OS X 10.13.6
Desktop
6 years ago
Test name Executions per second
indexOf first 9473209.0 Ops/sec
$.inArray first 2349216.8 Ops/sec
indexOf last 9605187.0 Ops/sec
$.inArray last 474419.8 Ops/sec
indexOf middle 9453648.0 Ops/sec
$.inArray middle 829556.1 Ops/sec
indexOf 2989431.5 Ops/sec
$.inArray 259632.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray