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() 1925877.6 Ops/sec
getElementsByClassName() 1890871.9 Ops/sec
getElementsByTagName() 1342236.5 Ops/sec
querySelector(#id) 966221.1 Ops/sec
querySelector(.id) 1550671.0 Ops/sec
querySelectorAll(#id) 569687.6 Ops/sec
querySelectorAll(.id) 547973.5 Ops/sec
jQuery(#id) 594090.5 Ops/sec
jQuery(.id) 338224.8 Ops/sec
jQuery(tag#id) 292860.1 Ops/sec
jQuery(tag.id) 292352.5 Ops/sec
jQuery + getElementById 666238.9 Ops/sec
jQuery + getElementsByClassName 202948.0 Ops/sec
jQuery + querySelectorAll 235710.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


;