Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Firefox 66
Ubuntu
Desktop
5 years ago
Test name Executions per second
getElementById() 2367705.0 Ops/sec
getElementsByClassName() 1993569.6 Ops/sec
getElementsByTagName() 2615801.2 Ops/sec
querySelector(#id) 2600296.5 Ops/sec
querySelector(.id) 2630504.8 Ops/sec
querySelectorAll(#id) 1082610.6 Ops/sec
querySelectorAll(.id) 1198579.9 Ops/sec
jQuery(#id) 3146930.0 Ops/sec
jQuery(.id) 850541.9 Ops/sec
jQuery(tag#id) 485475.0 Ops/sec
jQuery(tag.id) 514808.9 Ops/sec
jQuery + getElementById 2131120.5 Ops/sec
jQuery + getElementsByClassName 776534.7 Ops/sec
HTML Preparation code:
Tests:
  • getElementById

  • getElementsByClassName

  • getElementsByTagName

  • querySelector (#id)

  • querySelector (.id)

  • querySelectorAll (#id)

  • querySelectorAll (.id)

  • Cash (#id)

  • Cash (.id)

  • Cash (tag#id)

  • Cash (tag.id)

  • Cash + getElementById

  • Cash + getElementsByClassName

  • jQuery (#id)

  • jQuery (.id)

  • jQuery (tag#id)

  • jQuery (tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName


;