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 1787575.6 Ops/sec
getElementsByClassName 1398588.1 Ops/sec
querySelector 1414756.0 Ops/sec
querySelectorAll 1067812.5 Ops/sec
jQuery 806348.2 Ops/sec
jQuery + getElementById 802110.4 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