Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36
Chrome 68
Mac OS X 10.13.5
Desktop
6 years ago
Test name Executions per second
indexOf first 12709479.0 Ops/sec
$.inArray first 3084596.2 Ops/sec
indexOf last 12552629.0 Ops/sec
$.inArray last 574136.0 Ops/sec
indexOf middle 12522174.0 Ops/sec
$.inArray middle 959343.1 Ops/sec
indexOf 4220068.5 Ops/sec
$.inArray 310262.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray