Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36
Chrome 69
Windows 7
Desktop
6 years ago
Test name Executions per second
indexOf first 9186823.0 Ops/sec
$.inArray first 2703836.2 Ops/sec
indexOf last 9167716.0 Ops/sec
$.inArray last 559615.2 Ops/sec
indexOf middle 9150885.0 Ops/sec
$.inArray middle 959375.6 Ops/sec
indexOf 3101727.8 Ops/sec
$.inArray 299299.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray