Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Chrome 85
Mac OS X 10.15.6
Desktop
4 years ago
Test name Executions per second
getElementById() 3493427.0 Ops/sec
getElementsByClassName() 2856959.8 Ops/sec
getElementsByTagName() 2904002.0 Ops/sec
querySelector(#id) 1986568.2 Ops/sec
querySelector(.id) 3614271.5 Ops/sec
querySelectorAll(#id) 1027524.0 Ops/sec
querySelectorAll(.id) 1448507.2 Ops/sec
jQuery(#id) 0.0 Ops/sec
jQuery(.id) 0.0 Ops/sec
jQuery(tag#id) 0.0 Ops/sec
jQuery(tag.id) 0.0 Ops/sec
jQuery + getElementById 0.0 Ops/sec
jQuery + getElementsByClassName 0.0 Ops/sec
jQuery + querySelectorAll 0.0 Ops/sec
querySelectorAll in function 1456162.5 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