Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Chrome 83
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 1525975.2 Ops/sec
jQuery (tag.id) 111943.5 Ops/sec
jQuery (tag#id) 94952.0 Ops/sec
jQuery (.id) 132612.7 Ops/sec
jQuery (#id) 556635.9 Ops/sec
Cash + getElementsByClassName 270595.4 Ops/sec
Cash + getElementById 431621.4 Ops/sec
Cash (tag.id) 209868.8 Ops/sec
jQuery + getElementById 493539.0 Ops/sec
Cash (tag#id) 138290.9 Ops/sec
Cash (#id) 624393.2 Ops/sec
querySelectorAll (.id) 514617.8 Ops/sec
querySelectorAll (#id) 304435.1 Ops/sec
querySelector (.id) 1474545.6 Ops/sec
querySelector (#id) 715369.6 Ops/sec
getElementsByTagName 1080460.5 Ops/sec
getElementsByClassName 954250.1 Ops/sec
Cash (.id) 191457.2 Ops/sec
jQuery + getElementsByClassName 154925.5 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