Run details:
Mozilla/5.0 (Linux; Android 8.1.0; Redmi 5 Plus Build/OPM1.171019.019) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36
Chrome Mobile 69
Android 8.1.0
Mobile
6 years ago
Test name Executions per second
getElementById() 540102.7 Ops/sec
getElementsByClassName() 344895.4 Ops/sec
getElementsByTagName() 419367.8 Ops/sec
querySelector(#id) 273899.0 Ops/sec
querySelector(.id) 384247.4 Ops/sec
querySelectorAll(#id) 160193.5 Ops/sec
querySelectorAll(.id) 187602.1 Ops/sec
jQuery(#id) 183159.3 Ops/sec
jQuery(.id) 107402.9 Ops/sec
jQuery(tag#id) 65000.8 Ops/sec
jQuery(tag.id) 66278.1 Ops/sec
jQuery + getElementById 226590.6 Ops/sec
jQuery + getElementsByClassName 77159.3 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