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 11140613.0 Ops/sec
$.inArray first 2847048.2 Ops/sec
indexOf last 11240264.0 Ops/sec
$.inArray last 598107.6 Ops/sec
indexOf middle 10459487.0 Ops/sec
$.inArray middle 978362.0 Ops/sec
indexOf 3666699.5 Ops/sec
$.inArray 322889.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray