Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0
Firefox 64
Ubuntu
Desktop
5 years ago
Test name Executions per second
getElementById() 579743.9 Ops/sec
getElementsByClassName() 600708.9 Ops/sec
getElementsByTagName() 666701.3 Ops/sec
querySelector(#id) 738140.7 Ops/sec
querySelector(.id) 696842.0 Ops/sec
querySelectorAll(#id) 205550.6 Ops/sec
querySelectorAll(.id) 248829.5 Ops/sec
jQuery(#id) 719403.1 Ops/sec
jQuery(.id) 123691.5 Ops/sec
jQuery(tag#id) 64109.3 Ops/sec
jQuery(tag.id) 64540.8 Ops/sec
jQuery + getElementById 543411.7 Ops/sec
jQuery + getElementsByClassName 141357.8 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


;