Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3965512.8 Ops/sec
getElementsByClassName() 3015661.0 Ops/sec
getElementsByTagName() 2963055.2 Ops/sec
querySelector(#id) 2185863.8 Ops/sec
querySelector(.id) 2918715.0 Ops/sec
querySelectorAll(#id) 955129.3 Ops/sec
querySelectorAll(.id) 1228195.6 Ops/sec
jQuery(#id) 992373.8 Ops/sec
jQuery(.id) 597203.2 Ops/sec
jQuery(tag#id) 432423.0 Ops/sec
jQuery(tag.id) 477408.8 Ops/sec
jQuery + getElementById 1412367.9 Ops/sec
jQuery + getElementsByClassName 389599.6 Ops/sec
jQuery + querySelectorAll 382290.7 Ops/sec
HTML Preparation code:
Tests:
  • getElementById()

  • getElementsByClassName()

  • getElementsByTagName()

  • querySelector(#id)

  • querySelector(.id)

  • querySelectorAll(#id)

  • querySelectorAll(.id)

  • jQuery(#id)

  • jQuery(.id)

  • jQuery(tag#id)

  • jQuery(tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName

  • jQuery + querySelectorAll


;