Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 10_1_1 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/54.0.2840.66 Mobile/14B100 Safari/602.1
Chrome Mobile iOS 54
iOS 10.1.1
iPhone
8 years ago
Test name Executions per second
getElementById() 1737060.8 Ops/sec
getElementsByClassName() 1318414.1 Ops/sec
getElementsByTagName() 1500250.2 Ops/sec
querySelector(#id) 1407148.1 Ops/sec
querySelector(.id) 310212.6 Ops/sec
querySelectorAll(#id) 1012217.0 Ops/sec
querySelectorAll(.id) 43256.3 Ops/sec
jQuery(#id) 861945.1 Ops/sec
jQuery(.id) 362068.5 Ops/sec
jQuery(tag#id) 259334.7 Ops/sec
jQuery(tag.id) 36479.8 Ops/sec
jQuery + getElementById 738614.4 Ops/sec
jQuery + getElementsByClassName 248276.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


;