Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
Chrome 86
Windows
Desktop
3 years ago
Test name Executions per second
getElementById 301357.8 Ops/sec
jQuery (tag.id) 182992.4 Ops/sec
jQuery (tag#id) 169246.6 Ops/sec
jQuery (.id) 250856.0 Ops/sec
jQuery (#id) 721388.3 Ops/sec
Cash + getElementsByClassName 405239.8 Ops/sec
Cash + getElementById 562660.6 Ops/sec
Cash (tag.id) 209751.6 Ops/sec
jQuery + getElementById 548583.1 Ops/sec
Cash (tag#id) 219754.9 Ops/sec
Cash (#id) 848677.7 Ops/sec
querySelectorAll (.id) 701015.1 Ops/sec
querySelectorAll (#id) 492508.7 Ops/sec
querySelector (.id) 1295995.8 Ops/sec
querySelector (#id) 653852.1 Ops/sec
getElementsByTagName 283714.4 Ops/sec
getElementsByClassName 478849.0 Ops/sec
Cash (.id) 273703.3 Ops/sec
jQuery + getElementsByClassName 236027.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


;