Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3275937.5 Ops/sec
jQuery (tag.id) 448907.6 Ops/sec
jQuery (tag#id) 424434.6 Ops/sec
jQuery (.id) 586125.8 Ops/sec
jQuery (#id) 1811284.4 Ops/sec
Cash + getElementsByClassName 1034311.0 Ops/sec
Cash + getElementById 1336995.1 Ops/sec
Cash (tag.id) 541673.9 Ops/sec
jQuery + getElementById 1410270.1 Ops/sec
Cash (tag#id) 500458.1 Ops/sec
Cash (#id) 2037957.6 Ops/sec
querySelectorAll (.id) 1831943.1 Ops/sec
querySelectorAll (#id) 965969.9 Ops/sec
querySelector (.id) 3379263.8 Ops/sec
querySelector (#id) 2089657.5 Ops/sec
getElementsByTagName 2832164.2 Ops/sec
getElementsByClassName 2296040.0 Ops/sec
Cash (.id) 696348.8 Ops/sec
jQuery + getElementsByClassName 584492.3 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