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() 1443131.1 Ops/sec
getElementsByClassName() 1731319.9 Ops/sec
getElementsByTagName() 1836581.2 Ops/sec
querySelector(#id) 1933061.9 Ops/sec
querySelector(.id) 1917117.6 Ops/sec
querySelectorAll(#id) 408138.0 Ops/sec
querySelectorAll(.id) 510187.1 Ops/sec
jQuery(#id) 1803588.8 Ops/sec
jQuery(.id) 366560.5 Ops/sec
jQuery(tag#id) 173167.6 Ops/sec
jQuery(tag.id) 190148.6 Ops/sec
jQuery + getElementById 1324663.8 Ops/sec
jQuery + getElementsByClassName 457819.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


;