Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.116
Opera 56
Windows
Desktop
6 years ago
Test name Executions per second
indexOf first 3567403.0 Ops/sec
$.inArray first 883026.1 Ops/sec
indexOf last 3254246.8 Ops/sec
$.inArray last 171877.5 Ops/sec
indexOf middle 3135956.8 Ops/sec
$.inArray middle 255411.6 Ops/sec
indexOf 966550.8 Ops/sec
$.inArray 95397.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray