Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1563784.4 Ops/sec
jQuery (tag.id) 203089.7 Ops/sec
jQuery (tag#id) 211860.7 Ops/sec
jQuery (.id) 317344.9 Ops/sec
jQuery (#id) 850298.6 Ops/sec
Cash + getElementsByClassName 494498.5 Ops/sec
Cash + getElementById 649814.9 Ops/sec
Cash (tag.id) 284731.0 Ops/sec
jQuery + getElementById 741939.2 Ops/sec
Cash (tag#id) 257713.3 Ops/sec
Cash (#id) 1058158.0 Ops/sec
querySelectorAll (.id) 897800.8 Ops/sec
querySelectorAll (#id) 583876.0 Ops/sec
querySelector (.id) 1929067.5 Ops/sec
querySelector (#id) 1068889.5 Ops/sec
getElementsByTagName 1435551.6 Ops/sec
getElementsByClassName 1238440.1 Ops/sec
Cash (.id) 368398.1 Ops/sec
jQuery + getElementsByClassName 307981.0 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