Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80
Mac OS X 10.14.6
Desktop
4 years ago
Test name Executions per second
indexOf first 18381758.0 Ops/sec
$.inArray first 4886304.0 Ops/sec
indexOf last 18376174.0 Ops/sec
$.inArray last 842857.1 Ops/sec
indexOf middle 18367882.0 Ops/sec
$.inArray middle 1420371.4 Ops/sec
indexOf 6201659.0 Ops/sec
$.inArray 465593.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray