Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36
Chrome 59
Linux
Other
7 years ago
Test name Executions per second
getElementById() 1351173.5 Ops/sec
getElementsByClassName() 958254.1 Ops/sec
getElementsByTagName() 1073936.8 Ops/sec
querySelector(#id) 1109558.8 Ops/sec
querySelector(.id) 264687.2 Ops/sec
querySelectorAll(#id) 445131.8 Ops/sec
querySelectorAll(.id) 52239.6 Ops/sec
jQuery(#id) 501910.9 Ops/sec
jQuery(.id) 258157.7 Ops/sec
jQuery(tag#id) 165073.0 Ops/sec
jQuery(tag.id) 41796.5 Ops/sec
jQuery + getElementById 624945.8 Ops/sec
jQuery + getElementsByClassName 183873.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