Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Chrome 71
Mac OS X 10.14.2
Desktop
5 years ago
Test name Executions per second
indexOf first 12665513.0 Ops/sec
$.inArray first 3350947.8 Ops/sec
indexOf last 12589992.0 Ops/sec
$.inArray last 671515.3 Ops/sec
indexOf middle 12415093.0 Ops/sec
$.inArray middle 1086263.2 Ops/sec
indexOf 4221272.5 Ops/sec
$.inArray 354844.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray