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() 2798651.8 Ops/sec
getElementsByClassName() 2230004.2 Ops/sec
getElementsByTagName() 2171017.5 Ops/sec
querySelector(#id) 1434269.4 Ops/sec
querySelector(.id) 2151501.0 Ops/sec
querySelectorAll(#id) 710745.4 Ops/sec
querySelectorAll(.id) 804634.5 Ops/sec
jQuery(#id) 598793.4 Ops/sec
jQuery(.id) 448407.7 Ops/sec
jQuery(tag#id) 238432.6 Ops/sec
jQuery(tag.id) 283429.2 Ops/sec
jQuery + getElementById 1017349.5 Ops/sec
jQuery + getElementsByClassName 258534.8 Ops/sec
jQuery + querySelectorAll 280609.8 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


;