Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Chrome 55
Linux
Other
7 years ago
Test name Executions per second
getElementById() 354393.8 Ops/sec
getElementsByClassName() 243541.4 Ops/sec
getElementsByTagName() 264683.1 Ops/sec
querySelector(#id) 296614.3 Ops/sec
querySelector(.id) 77229.2 Ops/sec
querySelectorAll(#id) 131722.9 Ops/sec
querySelectorAll(.id) 15226.9 Ops/sec
jQuery(#id) 75129.2 Ops/sec
jQuery(.id) 30373.6 Ops/sec
jQuery(tag#id) 24237.0 Ops/sec
jQuery(tag.id) 9382.2 Ops/sec
jQuery + getElementById 141765.5 Ops/sec
jQuery + getElementsByClassName 28648.1 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