Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
Firefox 86
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 4830080.5 Ops/sec
jQuery (tag.id) 569366.0 Ops/sec
jQuery (tag#id) 549507.8 Ops/sec
jQuery (.id) 893444.8 Ops/sec
jQuery (#id) 4707088.0 Ops/sec
Cash + getElementsByClassName 1660750.8 Ops/sec
Cash + getElementById 2837986.5 Ops/sec
Cash (tag.id) 877307.1 Ops/sec
jQuery + getElementById 3003140.2 Ops/sec
Cash (tag#id) 797309.1 Ops/sec
Cash (#id) 4479990.5 Ops/sec
querySelectorAll (.id) 1409158.2 Ops/sec
querySelectorAll (#id) 1166056.1 Ops/sec
querySelector (.id) 3193029.5 Ops/sec
querySelector (#id) 3293091.8 Ops/sec
getElementsByTagName 3566144.5 Ops/sec
getElementsByClassName 2536921.8 Ops/sec
Cash (.id) 1410952.6 Ops/sec
jQuery + getElementsByClassName 738473.2 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