Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1
Mobile Safari 11
iOS 11.3
Mobile
6 years ago
Test name Executions per second
getElementById() 1840673.2 Ops/sec
getElementsByClassName() 1537027.6 Ops/sec
getElementsByTagName() 1497502.8 Ops/sec
querySelector(#id) 1232248.4 Ops/sec
querySelector(.id) 1341150.8 Ops/sec
querySelectorAll(#id) 910028.4 Ops/sec
querySelectorAll(.id) 943929.8 Ops/sec
jQuery(#id) 411099.7 Ops/sec
jQuery(.id) 158301.5 Ops/sec
jQuery(tag#id) 91509.0 Ops/sec
jQuery(tag.id) 83837.6 Ops/sec
jQuery + getElementById 427353.7 Ops/sec
jQuery + getElementsByClassName 180427.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


;