Run details:
Mozilla/5.0 (Linux; Android 9; FIG-LX1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.89 Mobile Safari/537.36
Chrome Mobile 76
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 540832.7 Ops/sec
getElementsByClassName() 312523.4 Ops/sec
getElementsByTagName() 414939.6 Ops/sec
querySelector(#id) 324943.1 Ops/sec
querySelector(.id) 366668.2 Ops/sec
querySelectorAll(#id) 182045.1 Ops/sec
querySelectorAll(.id) 196427.2 Ops/sec
jQuery(#id) 189036.8 Ops/sec
jQuery(.id) 109450.7 Ops/sec
jQuery(tag#id) 70876.7 Ops/sec
jQuery(tag.id) 74274.5 Ops/sec
jQuery + getElementById 240150.9 Ops/sec
jQuery + getElementsByClassName 84454.1 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