Run details:
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36
Chrome 65
Windows 8.1
Other
2025 years ago
Test name Executions per second
indexOf first 8870548.0 Ops/sec
$.inArray first 2456164.2 Ops/sec
indexOf last 555263.6 Ops/sec
$.inArray last 466334.9 Ops/sec
indexOf middle 1028476.1 Ops/sec
$.inArray middle 788793.1 Ops/sec
indexOf 341543.8 Ops/sec
$.inArray 265777.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray