Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 5434686.5 Ops/sec
getElementsByClassName() 3184537.8 Ops/sec
getElementsByTagName() 4228354.0 Ops/sec
querySelector(#id) 3033071.8 Ops/sec
querySelector(.id) 4163490.2 Ops/sec
querySelectorAll(#id) 1576853.9 Ops/sec
querySelectorAll(.id) 2049611.8 Ops/sec
jQuery(#id) 1624804.0 Ops/sec
jQuery(.id) 810585.6 Ops/sec
jQuery(tag#id) 509870.0 Ops/sec
jQuery(tag.id) 539366.4 Ops/sec
jQuery + getElementById 2036525.9 Ops/sec
jQuery + getElementsByClassName 708703.4 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


;