Run details:
Mozilla/5.0 (Linux; Android 7.0; SLA-L22) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 Mobile Safari/537.36
Chrome Mobile 71
Android 7.0
Mobile
5 years ago
Test name Executions per second
getElementById() 307434.5 Ops/sec
getElementsByClassName() 219075.4 Ops/sec
getElementsByTagName() 257650.9 Ops/sec
querySelector(#id) 179877.4 Ops/sec
querySelector(.id) 237858.6 Ops/sec
querySelectorAll(#id) 115322.4 Ops/sec
querySelectorAll(.id) 141692.3 Ops/sec
jQuery(#id) 121896.6 Ops/sec
jQuery(.id) 79457.8 Ops/sec
jQuery(tag#id) 47368.8 Ops/sec
jQuery(tag.id) 49056.1 Ops/sec
jQuery + getElementById 151317.7 Ops/sec
jQuery + getElementsByClassName 60632.0 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