Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome 59
Mac OS X 10.12.6
Other
7 years ago
Test name Executions per second
indexOf first 5834352.0 Ops/sec
$.inArray first 2266132.8 Ops/sec
indexOf last 451121.4 Ops/sec
$.inArray last 405306.5 Ops/sec
indexOf middle 830328.4 Ops/sec
$.inArray middle 669992.0 Ops/sec
indexOf 278375.3 Ops/sec
$.inArray 227259.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray