Run details:
Mozilla/5.0 (Linux; Android 8.1.0; MI PLAY) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.99 Mobile Safari/537.36
Chrome Mobile 86
Android 8.1.0
Mobile
4 years ago
Test name Executions per second
getElementById 560368.9 Ops/sec
jQuery (tag.id) 85670.1 Ops/sec
jQuery (tag#id) 77147.0 Ops/sec
jQuery (.id) 121449.5 Ops/sec
jQuery (#id) 176853.2 Ops/sec
Cash + getElementsByClassName 181943.3 Ops/sec
Cash + getElementById 264652.1 Ops/sec
Cash (tag.id) 138595.3 Ops/sec
jQuery + getElementById 264403.0 Ops/sec
Cash (tag#id) 124504.4 Ops/sec
Cash (#id) 205435.3 Ops/sec
querySelectorAll (.id) 240547.4 Ops/sec
querySelectorAll (#id) 208160.3 Ops/sec
querySelector (.id) 399363.3 Ops/sec
querySelector (#id) 322262.9 Ops/sec
getElementsByTagName 404858.5 Ops/sec
getElementsByClassName 376724.3 Ops/sec
Cash (.id) 182890.9 Ops/sec
jQuery + getElementsByClassName 99093.8 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