Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 2789991.2 Ops/sec
jQuery (tag.id) 492642.8 Ops/sec
jQuery (tag#id) 462224.4 Ops/sec
jQuery (.id) 778350.5 Ops/sec
jQuery (#id) 1597966.4 Ops/sec
Cash + getElementsByClassName 788035.4 Ops/sec
Cash + getElementById 1118293.4 Ops/sec
Cash (tag.id) 756482.5 Ops/sec
jQuery + getElementById 1256564.0 Ops/sec
Cash (tag#id) 631916.4 Ops/sec
Cash (#id) 1714503.9 Ops/sec
querySelectorAll (.id) 1163306.8 Ops/sec
querySelectorAll (#id) 760827.8 Ops/sec
querySelector (.id) 2188152.8 Ops/sec
querySelector (#id) 1663355.6 Ops/sec
getElementsByTagName 2355115.0 Ops/sec
getElementsByClassName 1469639.4 Ops/sec
Cash (.id) 932561.9 Ops/sec
jQuery + getElementsByClassName 505439.8 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


;