Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
Chrome 67
Windows
Desktop
6 years ago
Test name Executions per second
getElementById() 2633813.2 Ops/sec
getElementsByClassName() 1713469.2 Ops/sec
getElementsByTagName() 2092811.5 Ops/sec
querySelector(#id) 1599704.5 Ops/sec
querySelector(.id) 2142474.2 Ops/sec
querySelectorAll(#id) 641338.1 Ops/sec
querySelectorAll(.id) 896990.8 Ops/sec
jQuery(#id) 895233.4 Ops/sec
jQuery(.id) 326246.0 Ops/sec
jQuery(tag#id) 236812.6 Ops/sec
jQuery(tag.id) 231720.5 Ops/sec
jQuery + getElementById 1044998.2 Ops/sec
jQuery + getElementsByClassName 311608.2 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


;