Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Chrome 78
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3413272.8 Ops/sec
getElementsByClassName() 1782293.5 Ops/sec
getElementsByTagName() 2334217.0 Ops/sec
querySelector(#id) 1611196.5 Ops/sec
querySelector(.id) 2329666.2 Ops/sec
querySelectorAll(#id) 763373.9 Ops/sec
querySelectorAll(.id) 907627.0 Ops/sec
jQuery(#id) 745951.6 Ops/sec
jQuery(.id) 365924.9 Ops/sec
jQuery(tag#id) 272148.0 Ops/sec
jQuery(tag.id) 279332.7 Ops/sec
jQuery + getElementById 1028486.1 Ops/sec
jQuery + getElementsByClassName 338559.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


;