Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.45 Safari/537.36
Chrome 62
Windows
Other
7 years ago
Test name Executions per second
getElementById() 2293018.8 Ops/sec
getElementsByClassName() 1424051.6 Ops/sec
getElementsByTagName() 1497873.4 Ops/sec
querySelector(#id) 1929603.1 Ops/sec
querySelector(.id) 459780.7 Ops/sec
querySelectorAll(#id) 818240.8 Ops/sec
querySelectorAll(.id) 79865.8 Ops/sec
jQuery(#id) 624486.6 Ops/sec
jQuery(.id) 302379.3 Ops/sec
jQuery(tag#id) 199041.8 Ops/sec
jQuery(tag.id) 46969.4 Ops/sec
jQuery + getElementById 908331.7 Ops/sec
jQuery + getElementsByClassName 215404.5 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


;