Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3952.0 Safari/537.36
Chrome 80
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 1568727.5 Ops/sec
getElementsByClassName() 999066.3 Ops/sec
getElementsByTagName() 1320272.0 Ops/sec
querySelector(#id) 889245.9 Ops/sec
querySelector(.id) 1288313.5 Ops/sec
querySelectorAll(#id) 477572.0 Ops/sec
querySelectorAll(.id) 674524.9 Ops/sec
jQuery(#id) 427317.2 Ops/sec
jQuery(.id) 225433.7 Ops/sec
jQuery(tag#id) 162338.4 Ops/sec
jQuery(tag.id) 160553.3 Ops/sec
jQuery + getElementById 665706.7 Ops/sec
jQuery + getElementsByClassName 234136.1 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


;