Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36
Chrome 87
Mac OS X 10.15.7
Desktop
4 years ago
Test name Executions per second
getElementById 3542853.2 Ops/sec
jQuery (tag.id) 420569.6 Ops/sec
jQuery (tag#id) 406109.0 Ops/sec
jQuery (.id) 540591.6 Ops/sec
jQuery (#id) 1638805.2 Ops/sec
Cash + getElementsByClassName 954199.4 Ops/sec
Cash + getElementById 1199458.8 Ops/sec
Cash (tag.id) 523494.3 Ops/sec
jQuery + getElementById 1294213.2 Ops/sec
Cash (tag#id) 479781.4 Ops/sec
Cash (#id) 1899042.0 Ops/sec
querySelectorAll (.id) 1753732.4 Ops/sec
querySelectorAll (#id) 1155062.4 Ops/sec
querySelector (.id) 3620214.8 Ops/sec
querySelector (#id) 2211267.0 Ops/sec
getElementsByTagName 3006925.2 Ops/sec
getElementsByClassName 2183193.5 Ops/sec
Cash (.id) 641206.5 Ops/sec
jQuery + getElementsByClassName 547892.6 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