Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
Chrome 90
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 1599720.4 Ops/sec
jQuery (tag.id) 158685.3 Ops/sec
jQuery (tag#id) 161487.9 Ops/sec
jQuery (.id) 201277.8 Ops/sec
jQuery (#id) 843842.0 Ops/sec
Cash + getElementsByClassName 348734.3 Ops/sec
Cash + getElementById 617455.1 Ops/sec
Cash (tag.id) 232641.5 Ops/sec
jQuery + getElementById 635937.3 Ops/sec
Cash (tag#id) 220992.0 Ops/sec
Cash (#id) 878007.8 Ops/sec
querySelectorAll (.id) 867218.9 Ops/sec
querySelectorAll (#id) 524624.8 Ops/sec
querySelector (.id) 1704045.5 Ops/sec
querySelector (#id) 1007680.8 Ops/sec
getElementsByTagName 1322409.0 Ops/sec
getElementsByClassName 1077342.0 Ops/sec
Cash (.id) 261620.6 Ops/sec
jQuery + getElementsByClassName 222435.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