Run details:
Mozilla/5.0 (Android 10; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
Firefox Mobile 68
Android
Mobile
4 years ago
Test name Executions per second
getElementById 1423519.2 Ops/sec
jQuery (tag.id) 187365.1 Ops/sec
jQuery (tag#id) 182854.4 Ops/sec
jQuery (.id) 380601.5 Ops/sec
jQuery (#id) 1399187.9 Ops/sec
Cash + getElementsByClassName 797739.4 Ops/sec
Cash + getElementById 906239.4 Ops/sec
Cash (tag.id) 458587.8 Ops/sec
jQuery + getElementById 874741.2 Ops/sec
Cash (tag#id) 445110.8 Ops/sec
Cash (#id) 1660282.8 Ops/sec
querySelectorAll (.id) 701226.4 Ops/sec
querySelectorAll (#id) 614055.1 Ops/sec
querySelector (.id) 1815638.5 Ops/sec
querySelector (#id) 1803787.5 Ops/sec
getElementsByTagName 1787348.0 Ops/sec
getElementsByClassName 1226078.0 Ops/sec
Cash (.id) 804501.2 Ops/sec
jQuery + getElementsByClassName 334712.6 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