Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
Firefox 86
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3015652.5 Ops/sec
jQuery (tag.id) 270422.5 Ops/sec
jQuery (tag#id) 240366.9 Ops/sec
jQuery (.id) 404981.7 Ops/sec
jQuery (#id) 3226591.8 Ops/sec
Cash + getElementsByClassName 900542.1 Ops/sec
Cash + getElementById 1749222.5 Ops/sec
Cash (tag.id) 469081.1 Ops/sec
jQuery + getElementById 2215325.5 Ops/sec
Cash (tag#id) 406102.6 Ops/sec
Cash (#id) 2877005.0 Ops/sec
querySelectorAll (.id) 710355.4 Ops/sec
querySelectorAll (#id) 630871.1 Ops/sec
querySelector (.id) 2029705.0 Ops/sec
querySelector (#id) 2055877.8 Ops/sec
getElementsByTagName 2236559.0 Ops/sec
getElementsByClassName 1455696.4 Ops/sec
Cash (.id) 832639.8 Ops/sec
jQuery + getElementsByClassName 366579.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