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() 4387025.0 Ops/sec
getElementsByClassName() 3454781.0 Ops/sec
getElementsByTagName() 2903768.5 Ops/sec
querySelector(#id) 1638488.9 Ops/sec
querySelector(.id) 3525511.8 Ops/sec
querySelectorAll(#id) 799163.6 Ops/sec
querySelectorAll(.id) 1265956.2 Ops/sec
jQuery(#id) 1235467.2 Ops/sec
jQuery(.id) 400334.8 Ops/sec
jQuery(tag#id) 247628.1 Ops/sec
jQuery(tag.id) 242572.1 Ops/sec
jQuery + getElementById 1799421.9 Ops/sec
jQuery + getElementsByClassName 507521.8 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


;