Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36
Chrome 87
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 11327182.0 Ops/sec
$.inArray first 3527967.5 Ops/sec
indexOf last 11365387.0 Ops/sec
$.inArray last 767825.2 Ops/sec
indexOf middle 11477976.0 Ops/sec
$.inArray middle 1214414.2 Ops/sec
indexOf 3785088.2 Ops/sec
$.inArray 408152.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray