Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
getElementById 2224635.2 Ops/sec
jQuery (tag.id) 498251.5 Ops/sec
jQuery (tag#id) 437097.8 Ops/sec
jQuery (.id) 715300.1 Ops/sec
jQuery (#id) 1676095.9 Ops/sec
Cash + getElementsByClassName 868593.3 Ops/sec
Cash + getElementById 1071138.5 Ops/sec
Cash (tag.id) 716189.8 Ops/sec
jQuery + getElementById 1103736.1 Ops/sec
Cash (tag#id) 611385.0 Ops/sec
Cash (#id) 1807520.9 Ops/sec
querySelectorAll (.id) 1168492.4 Ops/sec
querySelectorAll (#id) 871966.6 Ops/sec
querySelector (.id) 2364270.5 Ops/sec
querySelector (#id) 1606698.4 Ops/sec
getElementsByTagName 2081678.6 Ops/sec
getElementsByClassName 1760381.1 Ops/sec
Cash (.id) 876896.8 Ops/sec
jQuery + getElementsByClassName 519339.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


;