Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Chrome 83
Windows 7
Desktop
4 years ago
Test name Executions per second
indexOf first 6437466.0 Ops/sec
$.inArray first 1887779.5 Ops/sec
indexOf last 6063804.5 Ops/sec
$.inArray last 452963.8 Ops/sec
indexOf middle 6436070.0 Ops/sec
$.inArray middle 629166.9 Ops/sec
indexOf 1852817.8 Ops/sec
$.inArray 247121.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray