Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.193 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 3370898.5 Ops/sec
jQuery (tag.id) 458423.9 Ops/sec
jQuery (tag#id) 428449.1 Ops/sec
jQuery (.id) 605009.1 Ops/sec
jQuery (#id) 1781333.9 Ops/sec
Cash + getElementsByClassName 1026095.6 Ops/sec
Cash + getElementById 1369051.9 Ops/sec
Cash (tag.id) 570414.1 Ops/sec
jQuery + getElementById 1471204.4 Ops/sec
Cash (tag#id) 530901.9 Ops/sec
Cash (#id) 1992575.6 Ops/sec
querySelectorAll (.id) 1721879.8 Ops/sec
querySelectorAll (#id) 1203450.8 Ops/sec
querySelector (.id) 3452953.8 Ops/sec
querySelector (#id) 2185921.2 Ops/sec
getElementsByTagName 2792912.5 Ops/sec
getElementsByClassName 2296233.5 Ops/sec
Cash (.id) 697958.9 Ops/sec
jQuery + getElementsByClassName 601163.0 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