Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Chrome 95
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3575667.0 Ops/sec
jQuery (tag.id) 634047.6 Ops/sec
jQuery (tag#id) 604966.9 Ops/sec
jQuery (.id) 849906.6 Ops/sec
jQuery (#id) 2124454.0 Ops/sec
Cash + getElementsByClassName 1258822.1 Ops/sec
Cash + getElementById 1685035.8 Ops/sec
Cash (tag.id) 809977.5 Ops/sec
jQuery + getElementById 1814174.5 Ops/sec
Cash (tag#id) 714908.0 Ops/sec
Cash (#id) 2208778.8 Ops/sec
querySelectorAll (.id) 1697776.2 Ops/sec
querySelectorAll (#id) 1243235.1 Ops/sec
querySelector (.id) 4060948.0 Ops/sec
querySelector (#id) 2487949.5 Ops/sec
getElementsByTagName 3169915.0 Ops/sec
getElementsByClassName 2362636.5 Ops/sec
Cash (.id) 961141.2 Ops/sec
jQuery + getElementsByClassName 729796.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