Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4115.0 Safari/537.36 Edg/84.0.488.1
Chrome 84
Mac OS X 10.15.4
Desktop
4 years ago
Test name Executions per second
getElementById 2176721.2 Ops/sec
jQuery (tag.id) 147333.6 Ops/sec
jQuery (tag#id) 175452.6 Ops/sec
jQuery (.id) 313999.7 Ops/sec
jQuery (#id) 557599.8 Ops/sec
Cash + getElementsByClassName 408059.4 Ops/sec
Cash + getElementById 571878.5 Ops/sec
Cash (tag.id) 316928.0 Ops/sec
jQuery + getElementById 873682.1 Ops/sec
Cash (tag#id) 276465.0 Ops/sec
Cash (#id) 1028472.2 Ops/sec
querySelectorAll (.id) 848055.2 Ops/sec
querySelectorAll (#id) 430149.5 Ops/sec
querySelector (.id) 1150198.1 Ops/sec
querySelector (#id) 1116744.2 Ops/sec
getElementsByTagName 1646520.2 Ops/sec
getElementsByClassName 1345320.2 Ops/sec
Cash (.id) 339104.8 Ops/sec
jQuery + getElementsByClassName 347996.9 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


;