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 68005064.0 Ops/sec
$.inArray first 11704142.0 Ops/sec
indexOf last 249532.2 Ops/sec
$.inArray last 244458.9 Ops/sec
indexOf middle 489782.4 Ops/sec
$.inArray middle 480087.4 Ops/sec
indexOf 161322.3 Ops/sec
$.inArray 161861.6 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray