Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 2247214.0 Ops/sec
jQuery (tag.id) 326152.1 Ops/sec
jQuery (tag#id) 304619.6 Ops/sec
jQuery (.id) 400907.3 Ops/sec
jQuery (#id) 1387172.0 Ops/sec
Cash + getElementsByClassName 706710.9 Ops/sec
Cash + getElementById 944920.0 Ops/sec
Cash (tag.id) 410844.8 Ops/sec
jQuery + getElementById 1040999.0 Ops/sec
Cash (tag#id) 369908.5 Ops/sec
Cash (#id) 1409849.0 Ops/sec
querySelectorAll (.id) 1106486.0 Ops/sec
querySelectorAll (#id) 826406.4 Ops/sec
querySelector (.id) 2522322.0 Ops/sec
querySelector (#id) 1521626.0 Ops/sec
getElementsByTagName 1972151.0 Ops/sec
getElementsByClassName 1619594.0 Ops/sec
Cash (.id) 482171.7 Ops/sec
jQuery + getElementsByClassName 409550.2 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