Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Chrome 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 912496.2 Ops/sec
jQuery (tag.id) 137674.3 Ops/sec
jQuery (tag#id) 117511.1 Ops/sec
jQuery (.id) 183975.5 Ops/sec
jQuery (#id) 534560.0 Ops/sec
Cash + getElementsByClassName 264781.1 Ops/sec
Cash + getElementById 351179.6 Ops/sec
Cash (tag.id) 163968.0 Ops/sec
jQuery + getElementById 403840.7 Ops/sec
Cash (tag#id) 157159.5 Ops/sec
Cash (#id) 500814.7 Ops/sec
querySelectorAll (.id) 451231.6 Ops/sec
querySelectorAll (#id) 292127.9 Ops/sec
querySelector (.id) 876296.9 Ops/sec
querySelector (#id) 524391.7 Ops/sec
getElementsByTagName 732625.1 Ops/sec
getElementsByClassName 585927.9 Ops/sec
Cash (.id) 192826.8 Ops/sec
jQuery + getElementsByClassName 164747.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


;