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 8592782.0 Ops/sec
$.inArray first 2367409.0 Ops/sec
indexOf last 8709867.0 Ops/sec
$.inArray last 581647.9 Ops/sec
indexOf middle 8636302.0 Ops/sec
$.inArray middle 932420.7 Ops/sec
indexOf 2893020.5 Ops/sec
$.inArray 303653.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray