Run details:
Mozilla/5.0 (Linux; Android 9; SM-G965F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.92 Mobile Safari/537.36
Chrome Mobile 77
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 1415322.8 Ops/sec
getElementsByClassName() 937312.4 Ops/sec
getElementsByTagName() 1051833.9 Ops/sec
querySelector(#id) 761477.8 Ops/sec
querySelector(.id) 988685.6 Ops/sec
querySelectorAll(#id) 438740.1 Ops/sec
querySelectorAll(.id) 603310.9 Ops/sec
jQuery(#id) 538275.3 Ops/sec
jQuery(.id) 278693.5 Ops/sec
jQuery(tag#id) 173507.1 Ops/sec
jQuery(tag.id) 169036.2 Ops/sec
jQuery + getElementById 703714.0 Ops/sec
jQuery + getElementsByClassName 208953.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