Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
Firefox 75
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3677267.5 Ops/sec
jQuery (tag.id) 551511.4 Ops/sec
jQuery (tag#id) 528065.7 Ops/sec
jQuery (.id) 926541.2 Ops/sec
jQuery (#id) 4330652.5 Ops/sec
Cash + getElementsByClassName 1610708.1 Ops/sec
Cash + getElementById 2626112.5 Ops/sec
Cash (tag.id) 1014420.6 Ops/sec
jQuery + getElementById 2784624.8 Ops/sec
Cash (tag#id) 951869.8 Ops/sec
Cash (#id) 5396183.5 Ops/sec
querySelectorAll (.id) 1250513.6 Ops/sec
querySelectorAll (#id) 1177926.9 Ops/sec
querySelector (.id) 2857339.5 Ops/sec
querySelector (#id) 2893816.8 Ops/sec
getElementsByTagName 3002450.0 Ops/sec
getElementsByClassName 2392779.0 Ops/sec
Cash (.id) 1845115.8 Ops/sec
jQuery + getElementsByClassName 869180.5 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