Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3637511.8 Ops/sec
getElementsByClassName() 2063983.6 Ops/sec
getElementsByTagName() 2742653.8 Ops/sec
querySelector(#id) 2019852.8 Ops/sec
querySelector(.id) 2753698.8 Ops/sec
querySelectorAll(#id) 1047707.8 Ops/sec
querySelectorAll(.id) 1315361.0 Ops/sec
jQuery(#id) 1044671.6 Ops/sec
jQuery(.id) 484293.5 Ops/sec
jQuery(tag#id) 368178.2 Ops/sec
jQuery(tag.id) 373493.3 Ops/sec
jQuery + getElementById 1211362.4 Ops/sec
jQuery + getElementsByClassName 456460.7 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


;