Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Firefox 68
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 2141289.5 Ops/sec
getElementsByClassName() 1788946.8 Ops/sec
getElementsByTagName() 2284698.8 Ops/sec
querySelector(#id) 2315342.0 Ops/sec
querySelector(.id) 2239635.2 Ops/sec
querySelectorAll(#id) 819613.9 Ops/sec
querySelectorAll(.id) 905589.5 Ops/sec
jQuery(#id) 2257843.8 Ops/sec
jQuery(.id) 711401.6 Ops/sec
jQuery(tag#id) 425911.6 Ops/sec
jQuery(tag.id) 419111.6 Ops/sec
jQuery + getElementById 1495490.2 Ops/sec
jQuery + getElementsByClassName 589179.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


;