Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Chrome 79
Mac OS X 10.14.5
Desktop
4 years ago
Test name Executions per second
getElementById() 3613454.8 Ops/sec
getElementsByClassName() 2063320.1 Ops/sec
getElementsByTagName() 2690182.2 Ops/sec
querySelector(#id) 1805511.1 Ops/sec
querySelector(.id) 2644698.5 Ops/sec
querySelectorAll(#id) 907990.3 Ops/sec
querySelectorAll(.id) 1140874.0 Ops/sec
jQuery(#id) 996268.2 Ops/sec
jQuery(.id) 464372.6 Ops/sec
jQuery(tag#id) 311324.8 Ops/sec
jQuery(tag.id) 304450.2 Ops/sec
jQuery + getElementById 1356551.0 Ops/sec
jQuery + getElementsByClassName 463992.5 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


;