Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
Chrome 60
Windows
Other
7 years ago
Test name Executions per second
indexOf first 6811477.5 Ops/sec
$.inArray first 2876154.0 Ops/sec
indexOf last 838927.8 Ops/sec
$.inArray last 721571.6 Ops/sec
indexOf middle 1496813.9 Ops/sec
$.inArray middle 1140302.9 Ops/sec
indexOf 517973.2 Ops/sec
$.inArray 390400.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray