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() 1011403.2 Ops/sec
getElementsByClassName() 795668.2 Ops/sec
getElementsByTagName() 795186.2 Ops/sec
querySelector(#id) 483094.1 Ops/sec
querySelector(.id) 857012.1 Ops/sec
querySelectorAll(#id) 305293.6 Ops/sec
querySelectorAll(.id) 491240.9 Ops/sec
jQuery(#id) 300984.8 Ops/sec
jQuery(.id) 148309.1 Ops/sec
jQuery(tag#id) 97584.1 Ops/sec
jQuery(tag.id) 100100.8 Ops/sec
jQuery + getElementById 458594.8 Ops/sec
jQuery + getElementsByClassName 218131.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