Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Chrome 65
Mac OS X 10.12.6
Other
6 years ago
Test name Executions per second
indexOf first 11287120.0 Ops/sec
$.inArray first 3488835.8 Ops/sec
indexOf last 890700.2 Ops/sec
$.inArray last 749749.1 Ops/sec
indexOf middle 1638646.8 Ops/sec
$.inArray middle 1213794.8 Ops/sec
indexOf 541943.2 Ops/sec
$.inArray 403989.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray