Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 5587570.5 Ops/sec
$.inArray first 1886090.8 Ops/sec
indexOf last 6520243.0 Ops/sec
$.inArray last 440096.8 Ops/sec
indexOf middle 6595189.0 Ops/sec
$.inArray middle 715035.4 Ops/sec
indexOf 2160518.2 Ops/sec
$.inArray 249240.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray