Run details:
Mozilla/5.0 (Linux; Android 8.0.0; SM-G950F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.91 Mobile Safari/537.36
Chrome Mobile 68
Android 8.0.0
Mobile
6 years ago
Test name Executions per second
getElementById() 1054722.5 Ops/sec
getElementsByClassName() 689256.8 Ops/sec
getElementsByTagName() 681437.8 Ops/sec
querySelector(#id) 438246.8 Ops/sec
querySelector(.id) 737605.8 Ops/sec
querySelectorAll(#id) 277002.8 Ops/sec
querySelectorAll(.id) 291216.8 Ops/sec
jQuery(#id) 337792.4 Ops/sec
jQuery(.id) 183897.2 Ops/sec
jQuery(tag#id) 100973.9 Ops/sec
jQuery(tag.id) 93498.1 Ops/sec
jQuery + getElementById 350740.6 Ops/sec
jQuery + getElementsByClassName 140362.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