Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Chrome 55
Windows
Other
7 years ago
Test name Executions per second
getElementById() 2056785.9 Ops/sec
getElementsByClassName() 1514781.4 Ops/sec
getElementsByTagName() 1706964.8 Ops/sec
querySelector(#id) 1757373.4 Ops/sec
querySelector(.id) 404197.4 Ops/sec
querySelectorAll(#id) 844313.5 Ops/sec
querySelectorAll(.id) 58527.9 Ops/sec
jQuery(#id) 875331.6 Ops/sec
jQuery(.id) 425511.0 Ops/sec
jQuery(tag#id) 275708.1 Ops/sec
jQuery(tag.id) 44659.5 Ops/sec
jQuery + getElementById 910577.2 Ops/sec
jQuery + getElementsByClassName 296826.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


;