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 4204040.0 Ops/sec
$.inArray first 1338033.6 Ops/sec
indexOf last 4194357.5 Ops/sec
$.inArray last 271165.9 Ops/sec
indexOf middle 4218963.5 Ops/sec
$.inArray middle 435518.0 Ops/sec
indexOf 1402843.2 Ops/sec
$.inArray 156516.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray