Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 3284581.5 Ops/sec
getElementsByClassName() 3127279.2 Ops/sec
getElementsByTagName() 3538245.8 Ops/sec
querySelector(#id) 3521493.8 Ops/sec
querySelector(.id) 3650600.8 Ops/sec
querySelectorAll(#id) 1162429.8 Ops/sec
querySelectorAll(.id) 1657667.4 Ops/sec
jQuery(#id) 3678971.8 Ops/sec
jQuery(.id) 1176227.9 Ops/sec
jQuery(tag#id) 598495.4 Ops/sec
jQuery(tag.id) 655674.1 Ops/sec
jQuery + getElementById 2724078.5 Ops/sec
jQuery + getElementsByClassName 1026767.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


;