Run details:
Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop; Lumia 1520) like Gecko
IE 11
Windows RT
Desktop
6 years ago
Test name Executions per second
getElementById() 113014.3 Ops/sec
getElementsByClassName() 80616.9 Ops/sec
getElementsByTagName() 82380.0 Ops/sec
querySelector(#id) 57020.5 Ops/sec
querySelector(.id) 45937.3 Ops/sec
querySelectorAll(#id) 32821.6 Ops/sec
querySelectorAll(.id) 33332.4 Ops/sec
jQuery(#id) 68863.9 Ops/sec
jQuery(.id) 26159.5 Ops/sec
jQuery(tag#id) 15447.5 Ops/sec
jQuery(tag.id) 15405.2 Ops/sec
jQuery + getElementById 69143.2 Ops/sec
jQuery + getElementsByClassName 16039.9 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