Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Chrome 75
Mac OS X 10.12.6
Desktop
5 years ago
Test name Executions per second
indexOf first 11848884.0 Ops/sec
$.inArray first 3784694.5 Ops/sec
indexOf last 12317835.0 Ops/sec
$.inArray last 743728.0 Ops/sec
indexOf middle 12106847.0 Ops/sec
$.inArray middle 1155386.5 Ops/sec
indexOf 4267449.0 Ops/sec
$.inArray 366412.8 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray