Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
Chrome 83
Linux
Desktop
4 years ago
Test name Executions per second
getElementById 2695673.8 Ops/sec
jQuery (tag.id) 394946.2 Ops/sec
jQuery (tag#id) 384762.0 Ops/sec
jQuery (.id) 538409.4 Ops/sec
jQuery (#id) 1465604.6 Ops/sec
Cash + getElementsByClassName 861356.6 Ops/sec
Cash + getElementById 1258395.2 Ops/sec
Cash (tag.id) 537568.4 Ops/sec
jQuery + getElementById 1265896.1 Ops/sec
Cash (tag#id) 477006.8 Ops/sec
Cash (#id) 1686066.9 Ops/sec
querySelectorAll (.id) 1489508.1 Ops/sec
querySelectorAll (#id) 1027551.3 Ops/sec
querySelector (.id) 3036068.5 Ops/sec
querySelector (#id) 1783811.2 Ops/sec
getElementsByTagName 1992749.1 Ops/sec
getElementsByClassName 1791948.6 Ops/sec
Cash (.id) 616566.9 Ops/sec
jQuery + getElementsByClassName 488665.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