Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0
Firefox 71
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3551016.0 Ops/sec
getElementsByClassName() 2378170.0 Ops/sec
getElementsByTagName() 2910559.5 Ops/sec
querySelector(#id) 2882901.0 Ops/sec
querySelector(.id) 2904886.0 Ops/sec
querySelectorAll(#id) 1137213.5 Ops/sec
querySelectorAll(.id) 1263124.5 Ops/sec
jQuery(#id) 3943330.2 Ops/sec
jQuery(.id) 819964.1 Ops/sec
jQuery(tag#id) 495580.3 Ops/sec
jQuery(tag.id) 506386.2 Ops/sec
jQuery + getElementById 2538895.8 Ops/sec
jQuery + getElementsByClassName 775479.7 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


;