Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36
Chrome 54
Windows
Other
8 years ago
Test name Executions per second
getElementById() 3240008.2 Ops/sec
getElementsByClassName() 2033402.8 Ops/sec
getElementsByTagName() 2756783.5 Ops/sec
querySelector(#id) 2558284.2 Ops/sec
querySelector(.id) 703229.1 Ops/sec
querySelectorAll(#id) 1237841.0 Ops/sec
querySelectorAll(.id) 106911.2 Ops/sec
jQuery(#id) 1297302.4 Ops/sec
jQuery(.id) 729595.8 Ops/sec
jQuery(tag#id) 491668.4 Ops/sec
jQuery(tag.id) 87110.4 Ops/sec
jQuery + getElementById 1404481.8 Ops/sec
jQuery + getElementsByClassName 433183.7 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


;