Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36 OPR/43.0.2442.806
Opera 43
Windows
Other
7 years ago
Test name Executions per second
indexOf first 9689520.0 Ops/sec
$.inArray first 3754952.5 Ops/sec
indexOf last 994749.7 Ops/sec
$.inArray last 851327.8 Ops/sec
indexOf middle 1786038.2 Ops/sec
$.inArray middle 1374862.9 Ops/sec
indexOf 610336.6 Ops/sec
$.inArray 467435.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray