Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A456 Safari/602.1
Mobile Safari 10
iOS 10.0.2
iPhone
8 years ago
Test name Executions per second
getElementById 1769884.4 Ops/sec
getElementsByClassName 1409892.9 Ops/sec
querySelector 1415541.5 Ops/sec
querySelectorAll 1044974.6 Ops/sec
jQuery 799849.4 Ops/sec
jQuery + getElementById 806543.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


;