Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_0_3 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A432 Safari/604.1
Mobile Safari 11
iOS 11.0.3
iPhone
7 years ago
Test name Executions per second
getElementById() 5016757.5 Ops/sec
getElementsByClassName() 4239071.5 Ops/sec
getElementsByTagName() 4352766.0 Ops/sec
querySelector(#id) 3675000.0 Ops/sec
querySelector(.id) 890314.8 Ops/sec
querySelectorAll(#id) 2754666.5 Ops/sec
querySelectorAll(.id) 98238.4 Ops/sec
jQuery(#id) 2474581.2 Ops/sec
jQuery(.id) 1514125.2 Ops/sec
jQuery(tag#id) 976218.1 Ops/sec
jQuery(tag.id) 82641.3 Ops/sec
jQuery + getElementById 2289925.0 Ops/sec
jQuery + getElementsByClassName 1102292.9 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


;