Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36
Chrome 91
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
indexOf first 17742848.0 Ops/sec
$.inArray first 5129781.0 Ops/sec
indexOf last 17933248.0 Ops/sec
$.inArray last 741734.4 Ops/sec
indexOf middle 18147416.0 Ops/sec
$.inArray middle 1277540.6 Ops/sec
indexOf 5979621.5 Ops/sec
$.inArray 417888.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray