Run details:
Mozilla/5.0 (Linux; Android 8.0.0; G3121 Build/48.1.A.2.50) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.86 Mobile Safari/537.36 EdgA/42.0.0.2746
Chrome Mobile 69
Android 8.0.0
Mobile
6 years ago
Test name Executions per second
getElementById() 492842.2 Ops/sec
getElementsByClassName() 288214.8 Ops/sec
getElementsByTagName() 356898.1 Ops/sec
querySelector(#id) 262989.6 Ops/sec
querySelector(.id) 374525.9 Ops/sec
querySelectorAll(#id) 123767.7 Ops/sec
querySelectorAll(.id) 170674.6 Ops/sec
jQuery(#id) 156164.8 Ops/sec
jQuery(.id) 90405.2 Ops/sec
jQuery(tag#id) 46033.9 Ops/sec
jQuery(tag.id) 46440.6 Ops/sec
jQuery + getElementById 197376.2 Ops/sec
jQuery + getElementsByClassName 67260.2 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