Run details:
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 OPR/54.0.2952.54
Opera 54
Windows 8.1
Desktop
6 years ago
Test name Executions per second
indexOf first 10712770.0 Ops/sec
$.inArray first 3013807.8 Ops/sec
indexOf last 10493385.0 Ops/sec
$.inArray last 645720.8 Ops/sec
indexOf middle 10919574.0 Ops/sec
$.inArray middle 1078991.1 Ops/sec
indexOf 3646030.5 Ops/sec
$.inArray 342968.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray