Run details:
Mozilla/5.0 (Linux; Android 9; Nokia 3.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36
Chrome Mobile 81
Android
Mobile
4 years ago
Test name Executions per second
getElementById 327634.6 Ops/sec
jQuery (tag.id) 46829.6 Ops/sec
jQuery (tag#id) 40521.2 Ops/sec
jQuery (.id) 78272.8 Ops/sec
jQuery (#id) 108677.9 Ops/sec
Cash + getElementsByClassName 100156.9 Ops/sec
Cash + getElementById 145354.6 Ops/sec
Cash (tag.id) 74001.9 Ops/sec
jQuery + getElementById 156026.4 Ops/sec
Cash (tag#id) 57293.6 Ops/sec
Cash (#id) 108028.0 Ops/sec
querySelectorAll (.id) 126823.7 Ops/sec
querySelectorAll (#id) 113180.7 Ops/sec
querySelector (.id) 247717.6 Ops/sec
querySelector (#id) 194698.9 Ops/sec
getElementsByTagName 252211.1 Ops/sec
getElementsByClassName 231010.8 Ops/sec
Cash (.id) 86059.3 Ops/sec
jQuery + getElementsByClassName 48255.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


;