Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Firefox 61
Windows
Desktop
6 years ago
Test name Executions per second
getElementById() 2519815.8 Ops/sec
getElementsByClassName() 2114649.0 Ops/sec
getElementsByTagName() 2578048.5 Ops/sec
querySelector(#id) 2715945.2 Ops/sec
querySelector(.id) 2600179.0 Ops/sec
querySelectorAll(#id) 640534.6 Ops/sec
querySelectorAll(.id) 1041614.6 Ops/sec
jQuery(#id) 2613314.5 Ops/sec
jQuery(.id) 370182.5 Ops/sec
jQuery(tag#id) 188493.6 Ops/sec
jQuery(tag.id) 205661.8 Ops/sec
jQuery + getElementById 2097691.0 Ops/sec
jQuery + getElementsByClassName 360270.2 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


;