Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36
Chrome 47
Windows 7
Other
7 years ago
Test name Executions per second
getElementById() 8420892.0 Ops/sec
getElementsByClassName() 2373442.8 Ops/sec
getElementsByTagName() 4945942.5 Ops/sec
querySelector(#id) 4737348.5 Ops/sec
querySelector(.id) 372196.7 Ops/sec
querySelectorAll(#id) 964385.1 Ops/sec
querySelectorAll(.id) 40307.1 Ops/sec
jQuery(#id) 1204313.1 Ops/sec
jQuery(.id) 296351.8 Ops/sec
jQuery(tag#id) 162663.7 Ops/sec
jQuery(tag.id) 32510.1 Ops/sec
jQuery + getElementById 1049341.2 Ops/sec
jQuery + getElementsByClassName 211514.9 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


;