Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko
IE 11
Windows 7
Other
7 years ago
Test name Executions per second
getElementById() 1244307.2 Ops/sec
getElementsByClassName() 995222.9 Ops/sec
getElementsByTagName() 967765.6 Ops/sec
querySelector(#id) 809318.9 Ops/sec
querySelector(.id) 158856.3 Ops/sec
querySelectorAll(#id) 30932.1 Ops/sec
querySelectorAll(.id) 27965.7 Ops/sec
jQuery(#id) 726303.5 Ops/sec
jQuery(.id) 299168.5 Ops/sec
jQuery(tag#id) 27086.4 Ops/sec
jQuery(tag.id) 25255.7 Ops/sec
jQuery + getElementById 835984.8 Ops/sec
jQuery + getElementsByClassName 172273.4 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


;