Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Chrome 74
Mac OS X 10.13.6
Desktop
5 years ago
Test name Executions per second
indexOf first 14101058.0 Ops/sec
$.inArray first 4339256.5 Ops/sec
indexOf last 13531062.0 Ops/sec
$.inArray last 781572.8 Ops/sec
indexOf middle 13917458.0 Ops/sec
$.inArray middle 1328548.2 Ops/sec
indexOf 4664249.5 Ops/sec
$.inArray 428029.2 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray