Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 9480378.0 Ops/sec
$.inArray first 2527346.2 Ops/sec
indexOf last 9347776.0 Ops/sec
$.inArray last 591351.7 Ops/sec
indexOf middle 9078451.0 Ops/sec
$.inArray middle 978309.1 Ops/sec
indexOf 3155662.2 Ops/sec
$.inArray 320029.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray