Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Firefox 70
Windows
Desktop
4 years ago
Test name Executions per second
getElementById() 2832487.8 Ops/sec
getElementsByClassName() 1801532.5 Ops/sec
getElementsByTagName() 2296639.2 Ops/sec
querySelector(#id) 2299546.8 Ops/sec
querySelector(.id) 2280884.2 Ops/sec
querySelectorAll(#id) 799873.9 Ops/sec
querySelectorAll(.id) 882222.6 Ops/sec
jQuery(#id) 3098578.0 Ops/sec
jQuery(.id) 663485.6 Ops/sec
jQuery(tag#id) 367592.6 Ops/sec
jQuery(tag.id) 421275.7 Ops/sec
jQuery + getElementById 1994254.2 Ops/sec
jQuery + getElementsByClassName 599320.6 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


;