Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
Firefox 50
Windows
Other
7 years ago
Test name Executions per second
indexOf first 30624548.0 Ops/sec
$.inArray first 17109564.0 Ops/sec
indexOf last 735126.4 Ops/sec
$.inArray last 629608.0 Ops/sec
indexOf middle 1667516.9 Ops/sec
$.inArray middle 1304167.9 Ops/sec
indexOf 506685.5 Ops/sec
$.inArray 436468.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • indexOf first

  • $.inArray first

  • indexOf last

  • $.inArray last

  • indexOf middle

  • $.inArray middle

  • indexOf

  • $.inArray