Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Chrome 79
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 3028164.0 Ops/sec
getElementsByClassName() 1768480.9 Ops/sec
getElementsByTagName() 2216783.5 Ops/sec
querySelector(#id) 1557486.2 Ops/sec
querySelector(.id) 2188884.0 Ops/sec
querySelectorAll(#id) 904183.1 Ops/sec
querySelectorAll(.id) 1097837.0 Ops/sec
jQuery(#id) 829630.4 Ops/sec
jQuery(.id) 421774.4 Ops/sec
jQuery(tag#id) 256215.8 Ops/sec
jQuery(tag.id) 285958.1 Ops/sec
jQuery + getElementById 1090701.2 Ops/sec
jQuery + getElementsByClassName 397076.9 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


;