Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Chrome 80
Mac OS X 10.15.4
Desktop
4 years ago
Test name Executions per second
indexOf first 16168178.0 Ops/sec
$.inArray first 4275085.0 Ops/sec
indexOf last 16029113.0 Ops/sec
$.inArray last 742375.2 Ops/sec
indexOf middle 15896445.0 Ops/sec
$.inArray middle 1244549.6 Ops/sec
indexOf 5437321.0 Ops/sec
$.inArray 406916.6 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray