Run details:
Mozilla/5.0 (Linux; U; Android 6.0.1; pl-pl; Redmi 4 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.128 Mobile Safari/537.36 XiaoMi/MiuiBrowser/10.2.4-g
Chrome Mobile 61
Android 6.0.1
Mobile
6 years ago
Test name Executions per second
getElementById() 430307.8 Ops/sec
getElementsByClassName() 305433.3 Ops/sec
getElementsByTagName() 307961.8 Ops/sec
querySelector(#id) 268557.9 Ops/sec
querySelector(.id) 320171.7 Ops/sec
querySelectorAll(#id) 124342.2 Ops/sec
querySelectorAll(.id) 135520.4 Ops/sec
jQuery(#id) 151038.7 Ops/sec
jQuery(.id) 77123.3 Ops/sec
jQuery(tag#id) 46861.7 Ops/sec
jQuery(tag.id) 48040.2 Ops/sec
jQuery + getElementById 189691.1 Ops/sec
jQuery + getElementsByClassName 77191.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