Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_1 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0 Mobile/15B93 Safari/604.1
Mobile Safari 11
iOS 11.1
iPhone
7 years ago
Test name Executions per second
getElementById() 2029033.8 Ops/sec
getElementsByClassName() 1510424.1 Ops/sec
getElementsByTagName() 1390638.9 Ops/sec
querySelector(#id) 1341503.0 Ops/sec
querySelector(.id) 348794.8 Ops/sec
querySelectorAll(#id) 1008194.5 Ops/sec
querySelectorAll(.id) 49403.3 Ops/sec
jQuery(#id) 898018.4 Ops/sec
jQuery(.id) 273110.8 Ops/sec
jQuery(tag#id) 203288.7 Ops/sec
jQuery(tag.id) 39471.8 Ops/sec
jQuery + getElementById 871129.9 Ops/sec
jQuery + getElementsByClassName 270207.3 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


;