Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68
Mac OS X 10.12.6
Desktop
6 years ago
Test name Executions per second
indexOf first 12033838.0 Ops/sec
$.inArray first 3097042.5 Ops/sec
indexOf last 11997491.0 Ops/sec
$.inArray last 652089.4 Ops/sec
indexOf middle 11946999.0 Ops/sec
$.inArray middle 1057253.0 Ops/sec
indexOf 4019293.2 Ops/sec
$.inArray 347960.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray