Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36
Chrome 74
Linux
Desktop
5 years ago
Test name Executions per second
getElementById() 1892351.1 Ops/sec
getElementsByClassName() 1094973.6 Ops/sec
getElementsByTagName() 1233042.6 Ops/sec
querySelector(#id) 875381.4 Ops/sec
querySelector(.id) 1268675.0 Ops/sec
querySelectorAll(#id) 357100.4 Ops/sec
querySelectorAll(.id) 435217.0 Ops/sec
jQuery(#id) 402423.6 Ops/sec
jQuery(.id) 183486.1 Ops/sec
jQuery(tag#id) 104760.5 Ops/sec
jQuery(tag.id) 115090.2 Ops/sec
jQuery + getElementById 531217.6 Ops/sec
jQuery + getElementsByClassName 186014.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


;