Run details:
Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Chrome 80
Windows 8
Desktop
4 years ago
Test name Executions per second
getElementById 2459327.8 Ops/sec
jQuery (tag.id) 99477.2 Ops/sec
jQuery (tag#id) 97272.7 Ops/sec
jQuery (.id) 111736.2 Ops/sec
jQuery (#id) 1311490.1 Ops/sec
Cash + getElementsByClassName 744458.3 Ops/sec
Cash + getElementById 974769.5 Ops/sec
Cash (tag.id) 63999.4 Ops/sec
jQuery + getElementById 1049828.9 Ops/sec
Cash (tag#id) 62880.7 Ops/sec
Cash (#id) 1476148.1 Ops/sec
querySelectorAll (.id) 1322238.4 Ops/sec
querySelectorAll (#id) 807003.5 Ops/sec
querySelector (.id) 2620239.5 Ops/sec
querySelector (#id) 1444017.6 Ops/sec
getElementsByTagName 1935801.0 Ops/sec
getElementsByClassName 1507457.1 Ops/sec
Cash (.id) 83654.6 Ops/sec
jQuery + getElementsByClassName 316465.9 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