Run details:
Mozilla/5.0 (Linux; Android 9; SNE-LX1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.96 Mobile Safari/537.36
Chrome Mobile 78
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 1402147.4 Ops/sec
getElementsByClassName() 816272.6 Ops/sec
getElementsByTagName() 1032798.6 Ops/sec
querySelector(#id) 793412.4 Ops/sec
querySelector(.id) 1021945.7 Ops/sec
querySelectorAll(#id) 411646.7 Ops/sec
querySelectorAll(.id) 501376.8 Ops/sec
jQuery(#id) 478239.0 Ops/sec
jQuery(.id) 292946.5 Ops/sec
jQuery(tag#id) 184491.0 Ops/sec
jQuery(tag.id) 193351.2 Ops/sec
jQuery + getElementById 587691.1 Ops/sec
jQuery + getElementsByClassName 210233.5 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