Run details:
Mozilla/5.0 (Linux; Android 9; ONEPLUS A6003) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Mobile Safari/537.36
Chrome Mobile 72
Android
Mobile
5 years ago
Test name Executions per second
getElementById() 1966999.5 Ops/sec
getElementsByClassName() 1328291.1 Ops/sec
getElementsByTagName() 1554331.8 Ops/sec
querySelector(#id) 952171.3 Ops/sec
querySelector(.id) 1391751.0 Ops/sec
querySelectorAll(#id) 462655.3 Ops/sec
querySelectorAll(.id) 586707.9 Ops/sec
jQuery(#id) 748724.7 Ops/sec
jQuery(.id) 446072.6 Ops/sec
jQuery(tag#id) 232530.4 Ops/sec
jQuery(tag.id) 239153.5 Ops/sec
jQuery + getElementById 900136.9 Ops/sec
jQuery + getElementsByClassName 339433.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