Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36
Chrome 81
Mac OS X 10.15.0
Desktop
4 years ago
Test name Executions per second
getElementById 2308187.2 Ops/sec
jQuery (tag.id) 280470.5 Ops/sec
jQuery (tag#id) 260471.4 Ops/sec
jQuery (.id) 419290.4 Ops/sec
jQuery (#id) 1061873.9 Ops/sec
Cash + getElementsByClassName 507234.6 Ops/sec
Cash + getElementById 826013.2 Ops/sec
Cash (tag.id) 305917.3 Ops/sec
jQuery + getElementById 856586.2 Ops/sec
Cash (tag#id) 282461.0 Ops/sec
Cash (#id) 1281952.6 Ops/sec
querySelectorAll (.id) 913590.8 Ops/sec
querySelectorAll (#id) 567547.1 Ops/sec
querySelector (.id) 2845134.8 Ops/sec
querySelector (#id) 1437448.0 Ops/sec
getElementsByTagName 1779356.5 Ops/sec
getElementsByClassName 1670114.4 Ops/sec
Cash (.id) 450379.6 Ops/sec
jQuery + getElementsByClassName 384088.2 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


;