Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
Chrome 60
Windows
Other
7 years ago
Test name Executions per second
getElementById() 3025211.2 Ops/sec
getElementsByClassName() 2056885.2 Ops/sec
getElementsByTagName() 2628959.8 Ops/sec
querySelector(#id) 2552850.8 Ops/sec
querySelector(.id) 543331.4 Ops/sec
querySelectorAll(#id) 882729.2 Ops/sec
querySelectorAll(.id) 85553.8 Ops/sec
jQuery(#id) 1201723.0 Ops/sec
jQuery(.id) 706569.7 Ops/sec
jQuery(tag#id) 356939.2 Ops/sec
jQuery(tag.id) 68131.9 Ops/sec
jQuery + getElementById 1291406.4 Ops/sec
jQuery + getElementsByClassName 418740.2 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


;