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() 2829337.8 Ops/sec
getElementsByClassName() 1778475.9 Ops/sec
getElementsByTagName() 1989867.0 Ops/sec
querySelector(#id) 1736156.0 Ops/sec
querySelector(.id) 2213047.0 Ops/sec
querySelectorAll(#id) 757731.3 Ops/sec
querySelectorAll(.id) 989596.0 Ops/sec
jQuery(#id) 817325.4 Ops/sec
jQuery(.id) 482864.8 Ops/sec
jQuery(tag#id) 320361.9 Ops/sec
jQuery(tag.id) 381247.2 Ops/sec
jQuery + getElementById 1114747.1 Ops/sec
jQuery + getElementsByClassName 274365.5 Ops/sec
jQuery + querySelectorAll 293244.9 Ops/sec
querySelectorAll in function 959463.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

  • querySelectorAll in function


;