Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15
Safari 13
Mac OS X 10.15.1
Desktop
4 years ago
Test name Executions per second
getElementById() 2641684.5 Ops/sec
getElementsByClassName() 2037557.6 Ops/sec
getElementsByTagName() 2264973.2 Ops/sec
querySelector(#id) 1903089.0 Ops/sec
querySelector(.id) 2059620.8 Ops/sec
querySelectorAll(#id) 1388301.9 Ops/sec
querySelectorAll(.id) 1496233.4 Ops/sec
jQuery(#id) 1518881.9 Ops/sec
jQuery(.id) 535214.2 Ops/sec
jQuery(tag#id) 449997.6 Ops/sec
jQuery(tag.id) 450459.2 Ops/sec
jQuery + getElementById 1333869.4 Ops/sec
jQuery + getElementsByClassName 748536.6 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


;