Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3119205.2 Ops/sec
jQuery (tag.id) 399120.0 Ops/sec
jQuery (tag#id) 386371.0 Ops/sec
jQuery (.id) 559400.9 Ops/sec
jQuery (#id) 1657501.9 Ops/sec
Cash + getElementsByClassName 937369.1 Ops/sec
Cash + getElementById 1232970.9 Ops/sec
Cash (tag.id) 500547.8 Ops/sec
jQuery + getElementById 1309009.9 Ops/sec
Cash (tag#id) 456709.8 Ops/sec
Cash (#id) 1865892.4 Ops/sec
querySelectorAll (.id) 1381623.1 Ops/sec
querySelectorAll (#id) 984769.7 Ops/sec
querySelector (.id) 3250849.0 Ops/sec
querySelector (#id) 1964915.0 Ops/sec
getElementsByTagName 2562641.5 Ops/sec
getElementsByClassName 2052076.8 Ops/sec
Cash (.id) 636134.1 Ops/sec
jQuery + getElementsByClassName 483496.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