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 12058356.0 Ops/sec
$.inArray first 3358040.5 Ops/sec
indexOf last 12190848.0 Ops/sec
$.inArray last 661197.6 Ops/sec
indexOf middle 12153638.0 Ops/sec
$.inArray middle 1087333.1 Ops/sec
indexOf 4100113.0 Ops/sec
$.inArray 357623.7 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray