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 3404383.2 Ops/sec
jQuery (tag.id) 468065.3 Ops/sec
jQuery (tag#id) 435035.1 Ops/sec
jQuery (.id) 758770.2 Ops/sec
jQuery (#id) 3418238.0 Ops/sec
Cash + getElementsByClassName 1116629.8 Ops/sec
Cash + getElementById 1873508.1 Ops/sec
Cash (tag.id) 664699.2 Ops/sec
jQuery + getElementById 2272829.5 Ops/sec
Cash (tag#id) 600545.0 Ops/sec
Cash (#id) 2245541.2 Ops/sec
querySelectorAll (.id) 745218.5 Ops/sec
querySelectorAll (#id) 860972.4 Ops/sec
querySelector (.id) 2423810.5 Ops/sec
querySelector (#id) 2222108.0 Ops/sec
getElementsByTagName 2070716.0 Ops/sec
getElementsByClassName 1754627.4 Ops/sec
Cash (.id) 927194.6 Ops/sec
jQuery + getElementsByClassName 589626.4 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