Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Ubuntu
Desktop
5 years ago
Test name Executions per second
getElementById() 586491.4 Ops/sec
getElementsByClassName() 617843.2 Ops/sec
getElementsByTagName() 657958.4 Ops/sec
querySelector(#id) 751766.6 Ops/sec
querySelector(.id) 738434.4 Ops/sec
querySelectorAll(#id) 198949.9 Ops/sec
querySelectorAll(.id) 250997.2 Ops/sec
jQuery(#id) 806547.2 Ops/sec
jQuery(.id) 128764.2 Ops/sec
jQuery(tag#id) 65199.3 Ops/sec
jQuery(tag.id) 65887.0 Ops/sec
jQuery + getElementById 509371.7 Ops/sec
jQuery + getElementsByClassName 119017.5 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