Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.51 Safari/537.36
Chrome 96
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 2783042.0 Ops/sec
jQuery (tag.id) 297445.8 Ops/sec
jQuery (tag#id) 286293.0 Ops/sec
jQuery (.id) 416009.9 Ops/sec
jQuery (#id) 1395109.1 Ops/sec
Cash + getElementsByClassName 785764.4 Ops/sec
Cash + getElementById 1029780.1 Ops/sec
Cash (tag.id) 558137.9 Ops/sec
jQuery + getElementById 1121165.6 Ops/sec
Cash (tag#id) 460656.4 Ops/sec
Cash (#id) 1499680.1 Ops/sec
querySelectorAll (.id) 1365737.0 Ops/sec
querySelectorAll (#id) 801305.9 Ops/sec
querySelector (.id) 2521291.2 Ops/sec
querySelector (#id) 1520163.4 Ops/sec
getElementsByTagName 2294517.8 Ops/sec
getElementsByClassName 1909623.9 Ops/sec
Cash (.id) 671716.3 Ops/sec
jQuery + getElementsByClassName 484695.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