Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36
Chrome 54
Windows
Other
8 years ago
Test name Executions per second
getElementById() 2998505.2 Ops/sec
getElementsByClassName() 2154272.5 Ops/sec
getElementsByTagName() 2652732.8 Ops/sec
querySelector(#id) 2406866.0 Ops/sec
querySelector(.id) 679116.7 Ops/sec
querySelectorAll(#id) 1092747.1 Ops/sec
querySelectorAll(.id) 104531.1 Ops/sec
jQuery(#id) 1216474.9 Ops/sec
jQuery(.id) 721552.8 Ops/sec
jQuery(tag#id) 453178.3 Ops/sec
jQuery(tag.id) 83677.8 Ops/sec
jQuery + getElementById 1295236.1 Ops/sec
jQuery + getElementsByClassName 424158.6 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


;