Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
Firefox 76
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3909905.2 Ops/sec
jQuery (tag.id) 553171.4 Ops/sec
jQuery (tag#id) 540121.8 Ops/sec
jQuery (.id) 1042485.9 Ops/sec
jQuery (#id) 5500582.5 Ops/sec
Cash + getElementsByClassName 1732251.2 Ops/sec
Cash + getElementById 2767091.5 Ops/sec
Cash (tag.id) 927485.4 Ops/sec
jQuery + getElementById 3143109.0 Ops/sec
Cash (tag#id) 875600.9 Ops/sec
Cash (#id) 5553544.5 Ops/sec
querySelectorAll (.id) 1128717.0 Ops/sec
querySelectorAll (#id) 1090016.1 Ops/sec
querySelector (.id) 2481576.8 Ops/sec
querySelector (#id) 2653307.5 Ops/sec
getElementsByTagName 3257377.0 Ops/sec
getElementsByClassName 2458874.8 Ops/sec
Cash (.id) 1924746.8 Ops/sec
jQuery + getElementsByClassName 917455.0 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


;