Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2186941.0 Ops/sec
jQuery (tag.id) 277969.3 Ops/sec
jQuery (tag#id) 259758.1 Ops/sec
jQuery (.id) 342378.4 Ops/sec
jQuery (#id) 948275.8 Ops/sec
Cash + getElementsByClassName 579393.9 Ops/sec
Cash + getElementById 810332.1 Ops/sec
Cash (tag.id) 355248.3 Ops/sec
jQuery + getElementById 838721.2 Ops/sec
Cash (tag#id) 319454.9 Ops/sec
Cash (#id) 1094251.9 Ops/sec
querySelectorAll (.id) 1012625.7 Ops/sec
querySelectorAll (#id) 618438.8 Ops/sec
querySelector (.id) 2422787.8 Ops/sec
querySelector (#id) 1241267.4 Ops/sec
getElementsByTagName 1704337.4 Ops/sec
getElementsByClassName 1361303.1 Ops/sec
Cash (.id) 399318.6 Ops/sec
jQuery + getElementsByClassName 337796.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