Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36
Chrome 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 2402796.5 Ops/sec
getElementsByClassName() 1703518.5 Ops/sec
getElementsByTagName() 2078762.0 Ops/sec
querySelector(#id) 1573756.8 Ops/sec
querySelector(.id) 2683894.8 Ops/sec
querySelectorAll(#id) 893243.3 Ops/sec
querySelectorAll(.id) 1469573.8 Ops/sec
jQuery(#id) 1532097.2 Ops/sec
jQuery(.id) 501852.7 Ops/sec
jQuery(tag#id) 349785.3 Ops/sec
jQuery(tag.id) 375367.5 Ops/sec
jQuery + getElementById 1163596.8 Ops/sec
jQuery + getElementsByClassName 484576.8 Ops/sec
HTML Preparation code:
Tests:
  • getElementById

  • getElementsByClassName

  • getElementsByTagName

  • querySelector (#id)

  • querySelector (.id)

  • querySelectorAll (#id)

  • querySelectorAll (.id)

  • Cash (#id)

  • Cash (.id)

  • Cash (tag#id)

  • Cash (tag.id)

  • Cash + getElementById

  • Cash + getElementsByClassName

  • jQuery (#id)

  • jQuery (.id)

  • jQuery (tag#id)

  • jQuery (tag.id)

  • jQuery + getElementById

  • jQuery + getElementsByClassName


;