Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0
Firefox 80
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 1357924.4 Ops/sec
jQuery (tag.id) 171152.8 Ops/sec
jQuery (tag#id) 165734.6 Ops/sec
jQuery (.id) 277692.0 Ops/sec
jQuery (#id) 1704434.6 Ops/sec
Cash + getElementsByClassName 504636.0 Ops/sec
Cash + getElementById 923129.9 Ops/sec
Cash (tag.id) 321198.6 Ops/sec
jQuery + getElementById 1025474.8 Ops/sec
Cash (tag#id) 310638.4 Ops/sec
Cash (#id) 1808645.1 Ops/sec
querySelectorAll (.id) 435698.4 Ops/sec
querySelectorAll (#id) 428674.0 Ops/sec
querySelector (.id) 1127057.9 Ops/sec
querySelector (#id) 1073278.6 Ops/sec
getElementsByTagName 995313.8 Ops/sec
getElementsByClassName 742678.0 Ops/sec
Cash (.id) 534160.5 Ops/sec
jQuery + getElementsByClassName 268540.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