Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 9027880.0 Ops/sec
$.inArray first 2779103.2 Ops/sec
indexOf last 8994599.0 Ops/sec
$.inArray last 568382.6 Ops/sec
indexOf middle 8643967.0 Ops/sec
$.inArray middle 938676.4 Ops/sec
indexOf 2996121.2 Ops/sec
$.inArray 306743.9 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray