Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36 OPR/67.0.3575.79
Opera 67
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2424254.5 Ops/sec
jQuery (tag.id) 329373.9 Ops/sec
jQuery (tag#id) 298223.1 Ops/sec
jQuery (.id) 417419.2 Ops/sec
jQuery (#id) 1144823.6 Ops/sec
Cash + getElementsByClassName 583220.3 Ops/sec
Cash + getElementById 922808.4 Ops/sec
Cash (tag.id) 406355.3 Ops/sec
jQuery + getElementById 928012.4 Ops/sec
Cash (tag#id) 356258.1 Ops/sec
Cash (#id) 1314501.9 Ops/sec
querySelectorAll (.id) 1219258.2 Ops/sec
querySelectorAll (#id) 803233.4 Ops/sec
querySelector (.id) 2235677.2 Ops/sec
querySelector (#id) 1481752.9 Ops/sec
getElementsByTagName 1946091.6 Ops/sec
getElementsByClassName 1515475.1 Ops/sec
Cash (.id) 449657.6 Ops/sec
jQuery + getElementsByClassName 343263.7 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