Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 2316406.2 Ops/sec
getElementsByClassName() 1865666.8 Ops/sec
getElementsByTagName() 1869781.4 Ops/sec
querySelector(#id) 1451695.0 Ops/sec
querySelector(.id) 1857798.6 Ops/sec
querySelectorAll(#id) 582388.8 Ops/sec
querySelectorAll(.id) 786987.2 Ops/sec
jQuery(#id) 626755.2 Ops/sec
jQuery(.id) 366583.9 Ops/sec
jQuery(tag#id) 282298.4 Ops/sec
jQuery(tag.id) 305861.6 Ops/sec
jQuery + getElementById 923872.2 Ops/sec
jQuery + getElementsByClassName 239157.3 Ops/sec
jQuery + querySelectorAll 243699.6 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