Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
Chrome 77
Windows 7
Desktop
5 years ago
Test name Executions per second
indexOf first 11777894.0 Ops/sec
$.inArray first 3595770.2 Ops/sec
indexOf last 11970899.0 Ops/sec
$.inArray last 649824.3 Ops/sec
indexOf middle 11851220.0 Ops/sec
$.inArray middle 1066261.6 Ops/sec
indexOf 3982691.0 Ops/sec
$.inArray 358688.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray