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() 4503897.0 Ops/sec
getElementsByClassName() 3701068.8 Ops/sec
getElementsByTagName() 3781126.0 Ops/sec
querySelector(#id) 1687712.2 Ops/sec
querySelector(.id) 3517821.5 Ops/sec
querySelectorAll(#id) 854247.1 Ops/sec
querySelectorAll(.id) 1298724.4 Ops/sec
jQuery(#id) 1006608.4 Ops/sec
jQuery(.id) 384843.8 Ops/sec
jQuery(tag#id) 254593.5 Ops/sec
jQuery(tag.id) 248491.7 Ops/sec
jQuery + getElementById 1598284.8 Ops/sec
jQuery + getElementsByClassName 537543.7 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