Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
Firefox 94
Windows
Desktop
3 years ago
Test name Executions per second
getElementById() 5798782.0 Ops/sec
getElementsByClassName() 3934078.8 Ops/sec
getElementsByTagName() 4003200.5 Ops/sec
querySelector(#id) 3871635.2 Ops/sec
querySelector(.id) 3940363.8 Ops/sec
querySelectorAll(#id) 1330359.4 Ops/sec
querySelectorAll(.id) 1582869.0 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 1593730.1 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