Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Chrome 65
Mac OS X 10.13.2
Other
6 years ago
Test name Executions per second
indexOf first 10189989.0 Ops/sec
$.inArray first 3361839.5 Ops/sec
indexOf last 793188.9 Ops/sec
$.inArray last 679704.4 Ops/sec
indexOf middle 1474831.9 Ops/sec
$.inArray middle 1131537.9 Ops/sec
indexOf 486924.5 Ops/sec
$.inArray 374406.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray