Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36
Safari537.36
Windows
Desktop
6 years ago
Test name Executions per second
indexOf first 9334692.0 Ops/sec
$.inArray first 2611648.2 Ops/sec
indexOf last 766051.3 Ops/sec
$.inArray last 646934.9 Ops/sec
indexOf middle 1513408.9 Ops/sec
$.inArray middle 1063888.6 Ops/sec
indexOf 514749.4 Ops/sec
$.inArray 336830.6 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray