Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1867202.1 Ops/sec
jQuery (tag.id) 204494.7 Ops/sec
jQuery (tag#id) 231884.7 Ops/sec
jQuery (.id) 346774.1 Ops/sec
jQuery (#id) 1030770.1 Ops/sec
Cash + getElementsByClassName 509712.6 Ops/sec
Cash + getElementById 734261.2 Ops/sec
Cash (tag.id) 255794.6 Ops/sec
jQuery + getElementById 761178.5 Ops/sec
Cash (tag#id) 283941.0 Ops/sec
Cash (#id) 1117127.9 Ops/sec
querySelectorAll (.id) 1040303.6 Ops/sec
querySelectorAll (#id) 705042.5 Ops/sec
querySelector (.id) 1792771.0 Ops/sec
querySelector (#id) 1158331.8 Ops/sec
getElementsByTagName 1582084.5 Ops/sec
getElementsByClassName 1198561.5 Ops/sec
Cash (.id) 357000.1 Ops/sec
jQuery + getElementsByClassName 275055.9 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