Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 OPR/56.0.3051.52
Opera 56
Windows 7
Desktop
6 years ago
Test name Executions per second
indexOf first 8182296.0 Ops/sec
$.inArray first 2504631.2 Ops/sec
indexOf last 8231393.5 Ops/sec
$.inArray last 414609.4 Ops/sec
indexOf middle 8305239.0 Ops/sec
$.inArray middle 721809.8 Ops/sec
indexOf 2765760.2 Ops/sec
$.inArray 244013.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray