Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Chrome 97
Windows
Desktop
2 years ago
Test name Executions per second
indexOf first 8118508.5 Ops/sec
$.inArray first 2590073.2 Ops/sec
indexOf last 7948673.0 Ops/sec
$.inArray last 390435.8 Ops/sec
indexOf middle 8128716.0 Ops/sec
$.inArray middle 692220.8 Ops/sec
indexOf 2764436.2 Ops/sec
$.inArray 231465.7 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray