Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36
Chrome 88
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 2412914.8 Ops/sec
jQuery (tag.id) 310860.9 Ops/sec
jQuery (tag#id) 291503.3 Ops/sec
jQuery (.id) 387826.0 Ops/sec
jQuery (#id) 1244475.2 Ops/sec
Cash + getElementsByClassName 703978.9 Ops/sec
Cash + getElementById 832285.1 Ops/sec
Cash (tag.id) 427313.5 Ops/sec
jQuery + getElementById 903092.4 Ops/sec
Cash (tag#id) 406644.1 Ops/sec
Cash (#id) 1582811.5 Ops/sec
querySelectorAll (.id) 1272206.9 Ops/sec
querySelectorAll (#id) 896124.4 Ops/sec
querySelector (.id) 2394098.8 Ops/sec
querySelector (#id) 1446780.4 Ops/sec
getElementsByTagName 2010547.9 Ops/sec
getElementsByClassName 1584488.6 Ops/sec
Cash (.id) 523084.2 Ops/sec
jQuery + getElementsByClassName 474201.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


;