Run details:
Mozilla/5.0 (Linux; Android 8.0.0; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36
Chrome Mobile 70
Android 8.0.0
Mobile
6 years ago
Test name Executions per second
getElementById() 792836.4 Ops/sec
getElementsByClassName() 477577.5 Ops/sec
getElementsByTagName() 544393.6 Ops/sec
querySelector(#id) 321215.6 Ops/sec
querySelector(.id) 479000.4 Ops/sec
querySelectorAll(#id) 229696.8 Ops/sec
querySelectorAll(.id) 236888.4 Ops/sec
jQuery(#id) 301641.2 Ops/sec
jQuery(.id) 186958.5 Ops/sec
jQuery(tag#id) 103727.7 Ops/sec
jQuery(tag.id) 102389.9 Ops/sec
jQuery + getElementById 353991.6 Ops/sec
jQuery + getElementsByClassName 133432.8 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