Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
Firefox 67
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 2945694.5 Ops/sec
getElementsByClassName() 2535275.2 Ops/sec
getElementsByTagName() 3171704.2 Ops/sec
querySelector(#id) 3016072.5 Ops/sec
querySelector(.id) 3004126.0 Ops/sec
querySelectorAll(#id) 1221754.8 Ops/sec
querySelectorAll(.id) 1357645.4 Ops/sec
jQuery(#id) 3140438.5 Ops/sec
jQuery(.id) 935463.0 Ops/sec
jQuery(tag#id) 545644.9 Ops/sec
jQuery(tag.id) 576876.5 Ops/sec
jQuery + getElementById 2145730.2 Ops/sec
jQuery + getElementsByClassName 838501.3 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


;