Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
Firefox 89
Windows
Desktop
3 years ago
Test name Executions per second
indexOf first 95046080.0 Ops/sec
$.inArray first 19892236.0 Ops/sec
indexOf last 381393.0 Ops/sec
$.inArray last 374425.6 Ops/sec
indexOf middle 753578.8 Ops/sec
$.inArray middle 728186.3 Ops/sec
indexOf 251569.8 Ops/sec
$.inArray 244177.7 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray