Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2342099.0 Ops/sec
jQuery (tag.id) 323064.5 Ops/sec
jQuery (tag#id) 297024.3 Ops/sec
jQuery (.id) 424537.1 Ops/sec
jQuery (#id) 1301407.1 Ops/sec
Cash + getElementsByClassName 696082.2 Ops/sec
Cash + getElementById 932027.4 Ops/sec
Cash (tag.id) 388324.0 Ops/sec
jQuery + getElementById 985990.7 Ops/sec
Cash (tag#id) 357267.4 Ops/sec
Cash (#id) 1460084.9 Ops/sec
querySelectorAll (.id) 1290602.1 Ops/sec
querySelectorAll (#id) 814581.8 Ops/sec
querySelector (.id) 2312329.5 Ops/sec
querySelector (#id) 1265847.8 Ops/sec
getElementsByTagName 1810291.6 Ops/sec
getElementsByClassName 1490160.6 Ops/sec
Cash (.id) 494018.4 Ops/sec
jQuery + getElementsByClassName 412130.8 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