Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2953550.5 Ops/sec
jQuery (tag.id) 398143.8 Ops/sec
jQuery (tag#id) 371380.8 Ops/sec
jQuery (.id) 528764.4 Ops/sec
jQuery (#id) 1728539.0 Ops/sec
Cash + getElementsByClassName 917955.6 Ops/sec
Cash + getElementById 1322956.4 Ops/sec
Cash (tag.id) 522914.6 Ops/sec
jQuery + getElementById 1300362.1 Ops/sec
Cash (tag#id) 479397.6 Ops/sec
Cash (#id) 1767319.5 Ops/sec
querySelectorAll (.id) 1651943.8 Ops/sec
querySelectorAll (#id) 1199428.0 Ops/sec
querySelector (.id) 2890540.0 Ops/sec
querySelector (#id) 1892075.5 Ops/sec
getElementsByTagName 2393950.2 Ops/sec
getElementsByClassName 2051068.2 Ops/sec
Cash (.id) 595178.6 Ops/sec
jQuery + getElementsByClassName 508097.4 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


;