Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
Chrome 77
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 3577878.0 Ops/sec
getElementsByClassName() 2152328.0 Ops/sec
getElementsByTagName() 2766032.2 Ops/sec
querySelector(#id) 2156273.0 Ops/sec
querySelector(.id) 2867909.2 Ops/sec
querySelectorAll(#id) 1010024.0 Ops/sec
querySelectorAll(.id) 1297664.8 Ops/sec
jQuery(#id) 1172526.2 Ops/sec
jQuery(.id) 575665.9 Ops/sec
jQuery(tag#id) 302988.0 Ops/sec
jQuery(tag.id) 328646.1 Ops/sec
jQuery + getElementById 1332091.1 Ops/sec
jQuery + getElementsByClassName 492065.0 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


;