Run details:
Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Chrome 48
Linux
Other
7 years ago
Test name Executions per second
getElementById() 1215573.6 Ops/sec
getElementsByClassName() 794650.1 Ops/sec
getElementsByTagName() 916521.8 Ops/sec
querySelector(#id) 966723.1 Ops/sec
querySelector(.id) 380302.6 Ops/sec
querySelectorAll(#id) 384777.8 Ops/sec
querySelectorAll(.id) 56782.3 Ops/sec
jQuery(#id) 328778.8 Ops/sec
jQuery(.id) 192429.9 Ops/sec
jQuery(tag#id) 98861.2 Ops/sec
jQuery(tag.id) 30266.8 Ops/sec
jQuery + getElementById 470587.9 Ops/sec
jQuery + getElementsByClassName 139066.4 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