Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:83.0) Gecko/20100101 Firefox/83.0
Firefox 83
Mac OS X 10.14
Desktop
4 years ago
Test name Executions per second
getElementById 2096560.9 Ops/sec
jQuery (tag.id) 194782.1 Ops/sec
jQuery (tag#id) 168787.4 Ops/sec
jQuery (.id) 260713.2 Ops/sec
jQuery (#id) 2212446.0 Ops/sec
Cash + getElementsByClassName 693575.8 Ops/sec
Cash + getElementById 1211579.1 Ops/sec
Cash (tag.id) 472552.2 Ops/sec
jQuery + getElementById 1507705.0 Ops/sec
Cash (tag#id) 285218.6 Ops/sec
Cash (#id) 1441078.9 Ops/sec
querySelectorAll (.id) 535747.3 Ops/sec
querySelectorAll (#id) 462516.2 Ops/sec
querySelector (.id) 1487368.1 Ops/sec
querySelector (#id) 1553127.2 Ops/sec
getElementsByTagName 1504182.5 Ops/sec
getElementsByClassName 1042612.8 Ops/sec
Cash (.id) 461735.7 Ops/sec
jQuery + getElementsByClassName 251379.2 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