Run details:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36 OPR/43.0.2442.806
Opera 43
Windows
Other
7 years ago
Test name Executions per second
getElementById() 3113828.2 Ops/sec
getElementsByClassName() 2127334.2 Ops/sec
getElementsByTagName() 2657505.2 Ops/sec
querySelector(#id) 2549670.5 Ops/sec
querySelector(.id) 610304.1 Ops/sec
querySelectorAll(#id) 1256412.6 Ops/sec
querySelectorAll(.id) 111650.2 Ops/sec
jQuery(#id) 1199226.6 Ops/sec
jQuery(.id) 809597.4 Ops/sec
jQuery(tag#id) 515033.8 Ops/sec
jQuery(tag.id) 90405.9 Ops/sec
jQuery + getElementById 1374546.9 Ops/sec
jQuery + getElementsByClassName 442921.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


;