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() 2987190.8 Ops/sec
getElementsByClassName() 2383180.8 Ops/sec
getElementsByTagName() 2280184.8 Ops/sec
querySelector(#id) 1709347.1 Ops/sec
querySelector(.id) 2222525.0 Ops/sec
querySelectorAll(#id) 760519.5 Ops/sec
querySelectorAll(.id) 998001.9 Ops/sec
jQuery(#id) 817969.8 Ops/sec
jQuery(.id) 468538.6 Ops/sec
jQuery(tag#id) 357528.1 Ops/sec
jQuery(tag.id) 382062.2 Ops/sec
jQuery + getElementById 1131234.5 Ops/sec
jQuery + getElementsByClassName 290883.6 Ops/sec
jQuery + querySelectorAll 170494.3 Ops/sec
querySelectorAll in function 681568.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


;