Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36 Edg/87.0.664.52
Chrome 87
Windows
Desktop
4 years ago
Test name Executions per second
indexOf first 6290415.0 Ops/sec
$.inArray first 1817391.1 Ops/sec
indexOf last 6673546.5 Ops/sec
$.inArray last 397853.6 Ops/sec
indexOf middle 6999786.5 Ops/sec
$.inArray middle 682398.6 Ops/sec
indexOf 2153059.0 Ops/sec
$.inArray 220939.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray