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
Chrome 69
Windows
Desktop
6 years ago
Test name Executions per second
indexOf first 13262487.0 Ops/sec
$.inArray first 3951454.8 Ops/sec
indexOf last 13641787.0 Ops/sec
$.inArray last 726121.9 Ops/sec
indexOf middle 13613641.0 Ops/sec
$.inArray middle 1195936.4 Ops/sec
indexOf 4548443.5 Ops/sec
$.inArray 394093.4 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray