Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
IE 11
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 1337655.9 Ops/sec
getElementsByClassName() 1033498.9 Ops/sec
getElementsByTagName() 1068295.2 Ops/sec
querySelector(#id) 865026.4 Ops/sec
querySelector(.id) 557753.4 Ops/sec
querySelectorAll(#id) 385722.8 Ops/sec
querySelectorAll(.id) 379425.8 Ops/sec
jQuery(#id) 1072884.0 Ops/sec
jQuery(.id) 379494.3 Ops/sec
jQuery(tag#id) 183467.3 Ops/sec
jQuery(tag.id) 175025.3 Ops/sec
jQuery + getElementById 973707.2 Ops/sec
jQuery + getElementsByClassName 246046.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


;