Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Firefox 65
Windows
Desktop
5 years ago
Test name Executions per second
getElementById() 1850640.8 Ops/sec
getElementsByClassName() 1803219.6 Ops/sec
getElementsByTagName() 2051063.0 Ops/sec
querySelector(#id) 1848650.5 Ops/sec
querySelector(.id) 1934270.1 Ops/sec
querySelectorAll(#id) 790807.3 Ops/sec
querySelectorAll(.id) 921841.8 Ops/sec
jQuery(#id) 2294695.5 Ops/sec
jQuery(.id) 619678.7 Ops/sec
jQuery(tag#id) 369031.5 Ops/sec
jQuery(tag.id) 386803.8 Ops/sec
jQuery + getElementById 1582263.0 Ops/sec
jQuery + getElementsByClassName 603521.4 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


;