Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3182219.2 Ops/sec
jQuery (tag.id) 582002.8 Ops/sec
jQuery (tag#id) 533417.5 Ops/sec
jQuery (.id) 878095.9 Ops/sec
jQuery (#id) 1821231.4 Ops/sec
Cash + getElementsByClassName 897449.1 Ops/sec
Cash + getElementById 1292440.0 Ops/sec
Cash (tag.id) 855105.2 Ops/sec
jQuery + getElementById 1425739.0 Ops/sec
Cash (tag#id) 727152.3 Ops/sec
Cash (#id) 1957898.9 Ops/sec
querySelectorAll (.id) 1402404.1 Ops/sec
querySelectorAll (#id) 985132.4 Ops/sec
querySelector (.id) 2589197.5 Ops/sec
querySelector (#id) 1979696.5 Ops/sec
getElementsByTagName 2704685.5 Ops/sec
getElementsByClassName 1677085.9 Ops/sec
Cash (.id) 1034500.6 Ops/sec
jQuery + getElementsByClassName 587561.4 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