Run details:
Mozilla/5.0 (Linux; U; Linux aarch64; 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() 871464.6 Ops/sec
getElementsByClassName() 674735.4 Ops/sec
getElementsByTagName() 619867.4 Ops/sec
querySelector(#id) 443805.5 Ops/sec
querySelector(.id) 764561.9 Ops/sec
querySelectorAll(#id) 273650.2 Ops/sec
querySelectorAll(.id) 447178.3 Ops/sec
jQuery(#id) 298466.0 Ops/sec
jQuery(.id) 151707.3 Ops/sec
jQuery(tag#id) 90031.4 Ops/sec
jQuery(tag.id) 89920.3 Ops/sec
jQuery + getElementById 427095.1 Ops/sec
jQuery + getElementsByClassName 186308.0 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