Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4083.0 Safari/537.36
Chrome 82
Mac OS X 10.15.3
Desktop
4 years ago
Test name Executions per second
indexOf first 5186343.5 Ops/sec
$.inArray first 1965230.2 Ops/sec
indexOf last 5302591.5 Ops/sec
$.inArray last 340925.7 Ops/sec
indexOf middle 5119755.0 Ops/sec
$.inArray middle 630453.1 Ops/sec
indexOf 2317206.5 Ops/sec
$.inArray 211479.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray