Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
Chrome 76
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 4444694.0 Ops/sec
getElementsByClassName() 2602481.8 Ops/sec
getElementsByTagName() 3366405.0 Ops/sec
querySelector(#id) 2435623.2 Ops/sec
querySelector(.id) 3411508.5 Ops/sec
querySelectorAll(#id) 1045989.4 Ops/sec
querySelectorAll(.id) 1316585.1 Ops/sec
jQuery(#id) 1376409.2 Ops/sec
jQuery(.id) 715358.3 Ops/sec
jQuery(tag#id) 424446.4 Ops/sec
jQuery(tag.id) 458432.8 Ops/sec
jQuery + getElementById 1581896.1 Ops/sec
jQuery + getElementsByClassName 604699.4 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


;