Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0
Firefox 84
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 4491294.0 Ops/sec
jQuery (tag.id) 654545.4 Ops/sec
jQuery (tag#id) 575172.9 Ops/sec
jQuery (.id) 949808.3 Ops/sec
jQuery (#id) 4501190.5 Ops/sec
Cash + getElementsByClassName 1485827.4 Ops/sec
Cash + getElementById 2786984.8 Ops/sec
Cash (tag.id) 1055164.1 Ops/sec
jQuery + getElementById 2992909.0 Ops/sec
Cash (tag#id) 983133.6 Ops/sec
Cash (#id) 4790230.0 Ops/sec
querySelectorAll (.id) 1384796.2 Ops/sec
querySelectorAll (#id) 1196538.0 Ops/sec
querySelector (.id) 3285605.5 Ops/sec
querySelector (#id) 3312894.8 Ops/sec
getElementsByTagName 3187537.8 Ops/sec
getElementsByClassName 2307527.8 Ops/sec
Cash (.id) 1474045.2 Ops/sec
jQuery + getElementsByClassName 750064.6 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