Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Chrome 65
Windows 7
Other
6 years ago
Test name Executions per second
indexOf first 9534598.0 Ops/sec
$.inArray first 3002831.5 Ops/sec
indexOf last 791411.3 Ops/sec
$.inArray last 667522.4 Ops/sec
indexOf middle 1369065.8 Ops/sec
$.inArray middle 1048227.4 Ops/sec
indexOf 466157.2 Ops/sec
$.inArray 373610.7 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray