Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 7712558.5 Ops/sec
$.inArray first 2656963.5 Ops/sec
indexOf last 7747925.0 Ops/sec
$.inArray last 343841.1 Ops/sec
indexOf middle 7790967.0 Ops/sec
$.inArray middle 615179.7 Ops/sec
indexOf 2572889.8 Ops/sec
$.inArray 212002.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray