Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Chrome 76
Mac OS X 10.11.6
Desktop
5 years ago
Test name Executions per second
indexOf first 7673300.0 Ops/sec
$.inArray first 2051669.9 Ops/sec
indexOf last 7763950.5 Ops/sec
$.inArray last 319191.2 Ops/sec
indexOf middle 7788487.5 Ops/sec
$.inArray middle 544428.6 Ops/sec
indexOf 2467391.8 Ops/sec
$.inArray 194604.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray