Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Firefox 70
Windows
Desktop
5 years ago
Test name Executions per second
indexOf first 41356044.0 Ops/sec
$.inArray first 7673176.0 Ops/sec
indexOf last 384316.8 Ops/sec
$.inArray last 371809.5 Ops/sec
indexOf middle 741184.9 Ops/sec
$.inArray middle 649566.8 Ops/sec
indexOf 259675.6 Ops/sec
$.inArray 213769.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray