Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Firefox 70
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 3120591.0 Ops/sec
getElementsByClassName() 1857369.2 Ops/sec
getElementsByTagName() 2548320.2 Ops/sec
querySelector(#id) 2451948.5 Ops/sec
querySelector(.id) 2413002.5 Ops/sec
querySelectorAll(#id) 951046.0 Ops/sec
querySelectorAll(.id) 900413.0 Ops/sec
jQuery(#id) 2800013.0 Ops/sec
jQuery(.id) 724591.2 Ops/sec
jQuery(tag#id) 459262.5 Ops/sec
jQuery(tag.id) 503570.0 Ops/sec
jQuery + getElementById 2032059.2 Ops/sec
jQuery + getElementsByClassName 626901.5 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


;