Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36
Chrome 95
Windows 7
Desktop
3 years ago
Test name Executions per second
indexOf first 7994674.5 Ops/sec
$.inArray first 2602040.5 Ops/sec
indexOf last 8085313.5 Ops/sec
$.inArray last 258771.5 Ops/sec
indexOf middle 4758144.0 Ops/sec
$.inArray middle 455508.3 Ops/sec
indexOf 2746408.2 Ops/sec
$.inArray 163253.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray