Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/54.0.2840.66 Mobile/14B72 Safari/602.1
Chrome Mobile iOS 54
iOS 10.1
iPhone
8 years ago
Test name Executions per second
getElementById() 1786829.6 Ops/sec
getElementsByClassName() 1376029.9 Ops/sec
getElementsByTagName() 1644314.1 Ops/sec
querySelector(#id) 1401122.4 Ops/sec
querySelector(.id) 291945.3 Ops/sec
querySelectorAll(#id) 1050614.2 Ops/sec
querySelectorAll(.id) 42899.1 Ops/sec
jQuery(#id) 789679.1 Ops/sec
jQuery(.id) 384503.5 Ops/sec
jQuery(tag#id) 269537.2 Ops/sec
jQuery(tag.id) 36114.0 Ops/sec
jQuery + getElementById 811363.8 Ops/sec
jQuery + getElementsByClassName 331602.1 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