Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Firefox 70
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3590077.5 Ops/sec
getElementsByClassName() 2336164.2 Ops/sec
getElementsByTagName() 2949456.0 Ops/sec
querySelector(#id) 2853941.5 Ops/sec
querySelector(.id) 2713537.5 Ops/sec
querySelectorAll(#id) 1125812.2 Ops/sec
querySelectorAll(.id) 1257119.8 Ops/sec
jQuery(#id) 4030616.8 Ops/sec
jQuery(.id) 990502.2 Ops/sec
jQuery(tag#id) 535185.5 Ops/sec
jQuery(tag.id) 560567.8 Ops/sec
jQuery + getElementById 2581923.0 Ops/sec
jQuery + getElementsByClassName 851539.1 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


;