Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Chrome 83
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2297765.2 Ops/sec
jQuery (tag.id) 351419.2 Ops/sec
jQuery (tag#id) 280162.6 Ops/sec
jQuery (.id) 334621.0 Ops/sec
jQuery (#id) 1087989.0 Ops/sec
Cash + getElementsByClassName 487819.3 Ops/sec
Cash + getElementById 648013.5 Ops/sec
Cash (tag.id) 518013.8 Ops/sec
jQuery + getElementById 907215.5 Ops/sec
Cash (tag#id) 274957.8 Ops/sec
Cash (#id) 1203192.1 Ops/sec
querySelectorAll (.id) 1023216.6 Ops/sec
querySelectorAll (#id) 784634.9 Ops/sec
querySelector (.id) 2504985.0 Ops/sec
querySelector (#id) 1592726.0 Ops/sec
getElementsByTagName 2031524.6 Ops/sec
getElementsByClassName 1556554.5 Ops/sec
Cash (.id) 416843.5 Ops/sec
jQuery + getElementsByClassName 345952.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