Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
Chrome 81
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 1636202.8 Ops/sec
jQuery (tag.id) 226624.0 Ops/sec
jQuery (tag#id) 227330.8 Ops/sec
jQuery (.id) 293497.0 Ops/sec
jQuery (#id) 917369.4 Ops/sec
Cash + getElementsByClassName 487668.3 Ops/sec
Cash + getElementById 693865.2 Ops/sec
Cash (tag.id) 293521.4 Ops/sec
jQuery + getElementById 733076.8 Ops/sec
Cash (tag#id) 281466.0 Ops/sec
Cash (#id) 1034873.2 Ops/sec
querySelectorAll (.id) 877628.3 Ops/sec
querySelectorAll (#id) 585763.7 Ops/sec
querySelector (.id) 1719958.5 Ops/sec
querySelector (#id) 1029281.7 Ops/sec
getElementsByTagName 1337507.4 Ops/sec
getElementsByClassName 1024451.9 Ops/sec
Cash (.id) 337778.2 Ops/sec
jQuery + getElementsByClassName 286175.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