Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Chrome 73
Mac OS X 10.14.4
Desktop
5 years ago
Test name Executions per second
indexOf first 13265589.0 Ops/sec
$.inArray first 3799012.2 Ops/sec
indexOf last 13461865.0 Ops/sec
$.inArray last 702948.8 Ops/sec
indexOf middle 13477261.0 Ops/sec
$.inArray middle 1184019.0 Ops/sec
indexOf 4505449.5 Ops/sec
$.inArray 386017.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray