Run details:
Mozilla/5.0 (Linux; Android 8.1.0; vivo 1803) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.105 Mobile Safari/537.36
Chrome Mobile 72
Android 8.1.0
Mobile
5 years ago
Test name Executions per second
getElementById() 477162.8 Ops/sec
getElementsByClassName() 252664.2 Ops/sec
getElementsByTagName() 289345.9 Ops/sec
querySelector(#id) 226251.3 Ops/sec
querySelector(.id) 285479.3 Ops/sec
querySelectorAll(#id) 123886.9 Ops/sec
querySelectorAll(.id) 143300.5 Ops/sec
jQuery(#id) 141469.9 Ops/sec
jQuery(.id) 91430.0 Ops/sec
jQuery(tag#id) 49738.3 Ops/sec
jQuery(tag.id) 51871.5 Ops/sec
jQuery + getElementById 172355.3 Ops/sec
jQuery + getElementsByClassName 68835.4 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


;