Run details:
Mozilla/5.0 (Linux; Android 8.0.0; SM-G930F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3529.0 Mobile Safari/537.36
Chrome Mobile 70
Android 8.0.0
Mobile
6 years ago
Test name Executions per second
getElementById() 1004385.1 Ops/sec
getElementsByClassName() 690349.2 Ops/sec
getElementsByTagName() 661769.6 Ops/sec
querySelector(#id) 390252.4 Ops/sec
querySelector(.id) 587493.0 Ops/sec
querySelectorAll(#id) 264982.8 Ops/sec
querySelectorAll(.id) 326240.7 Ops/sec
jQuery(#id) 369588.5 Ops/sec
jQuery(.id) 224919.3 Ops/sec
jQuery(tag#id) 117322.8 Ops/sec
jQuery(tag.id) 109451.4 Ops/sec
jQuery + getElementById 410026.5 Ops/sec
jQuery + getElementsByClassName 120077.9 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