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() 2778291.8 Ops/sec
getElementsByClassName() 2220285.2 Ops/sec
getElementsByTagName() 2160383.8 Ops/sec
querySelector(#id) 1686024.9 Ops/sec
querySelector(.id) 2019547.0 Ops/sec
querySelectorAll(#id) 700189.2 Ops/sec
querySelectorAll(.id) 920309.9 Ops/sec
jQuery(#id) 903696.4 Ops/sec
jQuery(.id) 491746.7 Ops/sec
jQuery(tag#id) 349029.6 Ops/sec
jQuery(tag.id) 403881.3 Ops/sec
jQuery + getElementById 934892.9 Ops/sec
jQuery + getElementsByClassName 611343.5 Ops/sec
jQuery + querySelectorAll 480103.0 Ops/sec
querySelectorAll in function 912797.0 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

  • querySelectorAll in function