Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0
Firefox 61
Mac OS X 10.13
Desktop
6 years ago
Test name Executions per second
getElementById() 2666084.0 Ops/sec
getElementsByClassName() 2324614.5 Ops/sec
getElementsByTagName() 2853219.2 Ops/sec
querySelector(#id) 2672157.5 Ops/sec
querySelector(.id) 2675447.5 Ops/sec
querySelectorAll(#id) 815197.2 Ops/sec
querySelectorAll(.id) 1023081.5 Ops/sec
jQuery(#id) 2505190.0 Ops/sec
jQuery(.id) 869632.6 Ops/sec
jQuery(tag#id) 426170.3 Ops/sec
jQuery(tag.id) 484177.2 Ops/sec
jQuery + getElementById 2175376.2 Ops/sec
jQuery + getElementsByClassName 635623.9 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


;