Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36
Chrome 60
Linux
Other
7 years ago
Test name Executions per second
getElementById() 2258206.8 Ops/sec
getElementsByClassName() 1376225.0 Ops/sec
getElementsByTagName() 1563240.2 Ops/sec
querySelector(#id) 1859294.8 Ops/sec
querySelector(.id) 493117.9 Ops/sec
querySelectorAll(#id) 657656.2 Ops/sec
querySelectorAll(.id) 57709.1 Ops/sec
jQuery(#id) 547207.2 Ops/sec
jQuery(.id) 281798.2 Ops/sec
jQuery(tag#id) 146231.3 Ops/sec
jQuery(tag.id) 32979.5 Ops/sec
jQuery + getElementById 810125.4 Ops/sec
jQuery + getElementsByClassName 192740.2 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