Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0
Firefox 72
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3567075.0 Ops/sec
getElementsByClassName() 2430659.0 Ops/sec
getElementsByTagName() 2953889.8 Ops/sec
querySelector(#id) 2830222.5 Ops/sec
querySelector(.id) 2354458.5 Ops/sec
querySelectorAll(#id) 1190351.8 Ops/sec
querySelectorAll(.id) 1216179.6 Ops/sec
jQuery(#id) 3761423.2 Ops/sec
jQuery(.id) 869370.9 Ops/sec
jQuery(tag#id) 523088.5 Ops/sec
jQuery(tag.id) 516173.5 Ops/sec
jQuery + getElementById 2570344.2 Ops/sec
jQuery + getElementsByClassName 825478.8 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


;