Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 2486668.0 Ops/sec
$.inArray first 2391112.2 Ops/sec
indexOf last 9096663.0 Ops/sec
$.inArray last 606131.0 Ops/sec
indexOf middle 8567062.0 Ops/sec
$.inArray middle 880244.1 Ops/sec
indexOf 2999781.2 Ops/sec
$.inArray 318371.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray