Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 3772062.0 Ops/sec
jQuery (tag.id) 629054.8 Ops/sec
jQuery (tag#id) 572662.4 Ops/sec
jQuery (.id) 928044.6 Ops/sec
jQuery (#id) 1974421.0 Ops/sec
Cash + getElementsByClassName 1010598.2 Ops/sec
Cash + getElementById 1500314.2 Ops/sec
Cash (tag.id) 1026274.5 Ops/sec
jQuery + getElementById 1578333.8 Ops/sec
Cash (tag#id) 856186.2 Ops/sec
Cash (#id) 2242937.0 Ops/sec
querySelectorAll (.id) 1375093.8 Ops/sec
querySelectorAll (#id) 1203578.0 Ops/sec
querySelector (.id) 3069457.2 Ops/sec
querySelector (#id) 2251217.0 Ops/sec
getElementsByTagName 3083570.0 Ops/sec
getElementsByClassName 1994975.4 Ops/sec
Cash (.id) 1160895.2 Ops/sec
jQuery + getElementsByClassName 640556.3 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