Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36
Chrome 72
Windows
Desktop
5 years ago
Test name Executions per second
indexOf first 13239501.0 Ops/sec
$.inArray first 3719500.2 Ops/sec
indexOf last 13058999.0 Ops/sec
$.inArray last 677421.9 Ops/sec
indexOf middle 12636991.0 Ops/sec
$.inArray middle 1174390.8 Ops/sec
indexOf 4278878.5 Ops/sec
$.inArray 377867.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray