Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Chrome 63
Windows
Other
2025 years ago
Test name Executions per second
getElementById() 2599751.5 Ops/sec
getElementsByClassName() 1697182.0 Ops/sec
getElementsByTagName() 1529067.0 Ops/sec
querySelector(#id) 2052067.4 Ops/sec
querySelector(.id) 509699.8 Ops/sec
querySelectorAll(#id) 858902.0 Ops/sec
querySelectorAll(.id) 89093.6 Ops/sec
jQuery(#id) 997781.8 Ops/sec
jQuery(.id) 553322.7 Ops/sec
jQuery(tag#id) 308177.1 Ops/sec
jQuery(tag.id) 33773.3 Ops/sec
jQuery + getElementById 441799.2 Ops/sec
jQuery + getElementsByClassName 87793.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


;