Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0
Firefox 63
Windows
Desktop
6 years ago
Test name Executions per second
getElementById() 1660125.5 Ops/sec
getElementsByClassName() 1622168.8 Ops/sec
getElementsByTagName() 1603267.1 Ops/sec
querySelector(#id) 1434367.6 Ops/sec
querySelector(.id) 1286125.1 Ops/sec
querySelectorAll(#id) 633008.2 Ops/sec
querySelectorAll(.id) 909558.6 Ops/sec
jQuery(#id) 1750780.1 Ops/sec
jQuery(.id) 459959.6 Ops/sec
jQuery(tag#id) 238880.5 Ops/sec
jQuery(tag.id) 358892.5 Ops/sec
jQuery + getElementById 1348016.2 Ops/sec
jQuery + getElementsByClassName 387701.3 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


;