Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 10654451.0 Ops/sec
$.inArray first 3287539.5 Ops/sec
indexOf last 10628541.0 Ops/sec
$.inArray last 669553.9 Ops/sec
indexOf middle 10719749.0 Ops/sec
$.inArray middle 1086421.8 Ops/sec
indexOf 3378072.0 Ops/sec
$.inArray 343554.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray