Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36
Chrome 69
Windows
Desktop
6 years ago
Test name Executions per second
indexOf first 11486061.0 Ops/sec
$.inArray first 3205158.5 Ops/sec
indexOf last 11566986.0 Ops/sec
$.inArray last 620754.6 Ops/sec
indexOf middle 11328668.0 Ops/sec
$.inArray middle 1031395.0 Ops/sec
indexOf 3828855.5 Ops/sec
$.inArray 333992.3 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray