Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1
Mobile Safari 12
iOS 12.4.1
Mobile
5 years ago
Test name Executions per second
getElementById() 3329510.0 Ops/sec
getElementsByClassName() 1873908.4 Ops/sec
getElementsByTagName() 2017222.2 Ops/sec
querySelector(#id) 1620499.1 Ops/sec
querySelector(.id) 1593555.6 Ops/sec
querySelectorAll(#id) 1168721.8 Ops/sec
querySelectorAll(.id) 1367737.8 Ops/sec
jQuery(#id) 1746329.9 Ops/sec
jQuery(.id) 867189.6 Ops/sec
jQuery(tag#id) 711357.2 Ops/sec
jQuery(tag.id) 725675.5 Ops/sec
jQuery + getElementById 1466405.0 Ops/sec
jQuery + getElementsByClassName 916989.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