Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0
Firefox 83
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 5148352.0 Ops/sec
jQuery (tag.id) 749963.9 Ops/sec
jQuery (tag#id) 693001.7 Ops/sec
jQuery (.id) 1131950.1 Ops/sec
jQuery (#id) 5394694.5 Ops/sec
Cash + getElementsByClassName 1787691.8 Ops/sec
Cash + getElementById 3199501.2 Ops/sec
Cash (tag.id) 1151829.5 Ops/sec
jQuery + getElementById 3179746.5 Ops/sec
Cash (tag#id) 1058342.5 Ops/sec
Cash (#id) 5335805.5 Ops/sec
querySelectorAll (.id) 1589680.5 Ops/sec
querySelectorAll (#id) 1395052.8 Ops/sec
querySelector (.id) 3902773.0 Ops/sec
querySelector (#id) 3805939.0 Ops/sec
getElementsByTagName 3807471.5 Ops/sec
getElementsByClassName 2803641.2 Ops/sec
Cash (.id) 1711060.5 Ops/sec
jQuery + getElementsByClassName 851162.8 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