Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Chrome 71
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 3726808.2 Ops/sec
getElementsByClassName() 2418011.0 Ops/sec
getElementsByTagName() 2832827.2 Ops/sec
querySelector(#id) 2143259.0 Ops/sec
querySelector(.id) 2892408.0 Ops/sec
querySelectorAll(#id) 848965.9 Ops/sec
querySelectorAll(.id) 1056313.6 Ops/sec
jQuery(#id) 1222263.8 Ops/sec
jQuery(.id) 580481.8 Ops/sec
jQuery(tag#id) 340097.3 Ops/sec
jQuery(tag.id) 324566.0 Ops/sec
jQuery + getElementById 1486779.6 Ops/sec
jQuery + getElementsByClassName 570243.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


;