Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
Firefox 74
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2929135.2 Ops/sec
jQuery (tag.id) 274861.7 Ops/sec
jQuery (tag#id) 273644.4 Ops/sec
jQuery (.id) 538429.0 Ops/sec
jQuery (#id) 3268382.8 Ops/sec
Cash + getElementsByClassName 1202200.8 Ops/sec
Cash + getElementById 2160053.5 Ops/sec
Cash (tag.id) 643223.9 Ops/sec
jQuery + getElementById 2142010.5 Ops/sec
Cash (tag#id) 600645.1 Ops/sec
Cash (#id) 4114098.2 Ops/sec
querySelectorAll (.id) 816197.2 Ops/sec
querySelectorAll (#id) 778572.2 Ops/sec
querySelector (.id) 1840278.5 Ops/sec
querySelector (#id) 2045199.0 Ops/sec
getElementsByTagName 2306462.5 Ops/sec
getElementsByClassName 1965722.8 Ops/sec
Cash (.id) 1423403.6 Ops/sec
jQuery + getElementsByClassName 485843.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