Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1553293.1 Ops/sec
jQuery (tag.id) 241883.1 Ops/sec
jQuery (tag#id) 218220.6 Ops/sec
jQuery (.id) 287201.3 Ops/sec
jQuery (#id) 846781.2 Ops/sec
Cash + getElementsByClassName 475460.7 Ops/sec
Cash + getElementById 628920.4 Ops/sec
Cash (tag.id) 298006.2 Ops/sec
jQuery + getElementById 658208.1 Ops/sec
Cash (tag#id) 248993.8 Ops/sec
Cash (#id) 880890.4 Ops/sec
querySelectorAll (.id) 891391.9 Ops/sec
querySelectorAll (#id) 565537.2 Ops/sec
querySelector (.id) 1975884.9 Ops/sec
querySelector (#id) 1063150.1 Ops/sec
getElementsByTagName 1337813.8 Ops/sec
getElementsByClassName 1119212.6 Ops/sec
Cash (.id) 345528.8 Ops/sec
jQuery + getElementsByClassName 292752.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