Run details:
Mozilla/5.0 (Linux; U; Linux x86_64; en-US) AppleWebKit/602.1+ (KHTML, like Gecko) Espial/6.8.6 Version/4.0 Safari/602.1+
WebKit Nightly 602
Linux
Desktop
4 years ago
Test name Executions per second
getElementById() 4201024.5 Ops/sec
getElementsByClassName() 2838770.8 Ops/sec
getElementsByTagName() 3737177.2 Ops/sec
querySelector(#id) 1464702.4 Ops/sec
querySelector(.id) 2884529.5 Ops/sec
querySelectorAll(#id) 823852.8 Ops/sec
querySelectorAll(.id) 1193612.0 Ops/sec
jQuery(#id) 1234510.6 Ops/sec
jQuery(.id) 388548.1 Ops/sec
jQuery(tag#id) 254210.1 Ops/sec
jQuery(tag.id) 254982.2 Ops/sec
jQuery + getElementById 1761006.4 Ops/sec
jQuery + getElementsByClassName 487730.9 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