Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8
Safari 10
Mac OS X 10.11.6
Other
7 years ago
Test name Executions per second
indexOf first 4366969.0 Ops/sec
$.inArray first 3259835.5 Ops/sec
indexOf last 355046.6 Ops/sec
$.inArray last 334350.4 Ops/sec
indexOf middle 678495.1 Ops/sec
$.inArray middle 593260.1 Ops/sec
indexOf 222636.6 Ops/sec
$.inArray 201656.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray