Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Chrome 79
Mac OS X 10.13.6
Desktop
4 years ago
Test name Executions per second
getElementById() 2871943.2 Ops/sec
getElementsByClassName() 1737340.1 Ops/sec
getElementsByTagName() 2252175.0 Ops/sec
querySelector(#id) 1520523.9 Ops/sec
querySelector(.id) 2189745.0 Ops/sec
querySelectorAll(#id) 623884.3 Ops/sec
querySelectorAll(.id) 837375.5 Ops/sec
jQuery(#id) 519038.8 Ops/sec
jQuery(.id) 217027.1 Ops/sec
jQuery(tag#id) 144165.2 Ops/sec
jQuery(tag.id) 144136.7 Ops/sec
jQuery + getElementById 905349.5 Ops/sec
jQuery + getElementsByClassName 228854.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


;