Run details:
Mozilla/5.0 (Linux; Android 6.0.1; Redmi Note 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36
Chrome Mobile 78
Android 6.0.1
Mobile
5 years ago
Test name Executions per second
getElementById() 1157324.4 Ops/sec
getElementsByClassName() 662644.1 Ops/sec
getElementsByTagName() 815683.1 Ops/sec
querySelector(#id) 639339.7 Ops/sec
querySelector(.id) 819170.6 Ops/sec
querySelectorAll(#id) 276587.0 Ops/sec
querySelectorAll(.id) 327626.8 Ops/sec
jQuery(#id) 268329.8 Ops/sec
jQuery(.id) 183196.0 Ops/sec
jQuery(tag#id) 109346.6 Ops/sec
jQuery(tag.id) 111992.5 Ops/sec
jQuery + getElementById 446748.3 Ops/sec
jQuery + getElementsByClassName 122216.9 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