Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Chrome 71
Mac OS X 10.14.2
Desktop
5 years ago
Test name Executions per second
indexOf first 17736382.0 Ops/sec
$.inArray first 4760058.5 Ops/sec
indexOf last 17870188.0 Ops/sec
$.inArray last 799967.5 Ops/sec
indexOf middle 17763084.0 Ops/sec
$.inArray middle 1359301.9 Ops/sec
indexOf 5946600.0 Ops/sec
$.inArray 445565.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray