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() 4208490.0 Ops/sec
getElementsByClassName() 3577773.0 Ops/sec
getElementsByTagName() 3624247.8 Ops/sec
querySelector(#id) 1507723.6 Ops/sec
querySelector(.id) 3565607.5 Ops/sec
querySelectorAll(#id) 843563.1 Ops/sec
querySelectorAll(.id) 1326224.9 Ops/sec
jQuery(#id) 1266461.6 Ops/sec
jQuery(.id) 453622.1 Ops/sec
jQuery(tag#id) 250912.9 Ops/sec
jQuery(tag.id) 252314.7 Ops/sec
jQuery + getElementById 1786744.5 Ops/sec
jQuery + getElementsByClassName 522051.6 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


;