Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Chrome 97
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
getElementById 4993147.5 Ops/sec
jQuery (tag.id) 696269.9 Ops/sec
jQuery (tag#id) 646716.6 Ops/sec
jQuery (.id) 952024.6 Ops/sec
jQuery (#id) 2252522.0 Ops/sec
Cash + getElementsByClassName 1512524.4 Ops/sec
Cash + getElementById 1938044.4 Ops/sec
Cash (tag.id) 992634.6 Ops/sec
jQuery + getElementById 1923974.9 Ops/sec
Cash (tag#id) 837275.6 Ops/sec
Cash (#id) 2780290.2 Ops/sec
querySelectorAll (.id) 2554824.5 Ops/sec
querySelectorAll (#id) 1587352.6 Ops/sec
querySelector (.id) 4796570.0 Ops/sec
querySelector (#id) 2738355.2 Ops/sec
getElementsByTagName 4098217.8 Ops/sec
getElementsByClassName 3405613.2 Ops/sec
Cash (.id) 1234449.9 Ops/sec
jQuery + getElementsByClassName 804693.9 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