Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36
Chrome 72
Mac OS X 10.13.6
Desktop
5 years ago
Test name Executions per second
indexOf first 14453010.0 Ops/sec
$.inArray first 3889414.8 Ops/sec
indexOf last 13433982.0 Ops/sec
$.inArray last 597177.6 Ops/sec
indexOf middle 14641319.0 Ops/sec
$.inArray middle 1103479.5 Ops/sec
indexOf 4831300.0 Ops/sec
$.inArray 337136.7 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray