Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Chrome 75
Windows
Desktop
5 years ago
Test name Executions per second
indexOf first 5841933.0 Ops/sec
$.inArray first 1877864.9 Ops/sec
indexOf last 5841649.5 Ops/sec
$.inArray last 437644.7 Ops/sec
indexOf middle 5652024.0 Ops/sec
$.inArray middle 601375.6 Ops/sec
indexOf 1804196.5 Ops/sec
$.inArray 236279.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray