Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Chrome 113
Windows
Desktop
one year ago
Test name Executions per second
getElementById 9807401.0 Ops/sec
jQuery (tag.id) 1195213.8 Ops/sec
jQuery (tag#id) 1071942.9 Ops/sec
jQuery (.id) 1820848.4 Ops/sec
jQuery (#id) 3126540.5 Ops/sec
Cash + getElementsByClassName 2443905.5 Ops/sec
Cash + getElementById 3651577.5 Ops/sec
Cash (tag.id) 1790193.1 Ops/sec
jQuery + getElementById 3771557.8 Ops/sec
Cash (tag#id) 1501449.8 Ops/sec
Cash (#id) 3667222.5 Ops/sec
querySelectorAll (.id) 2925993.5 Ops/sec
querySelectorAll (#id) 2379788.8 Ops/sec
querySelector (.id) 6122485.5 Ops/sec
querySelector (#id) 4450525.0 Ops/sec
getElementsByTagName 8048987.5 Ops/sec
getElementsByClassName 5546826.0 Ops/sec
Cash (.id) 2459406.8 Ops/sec
jQuery + getElementsByClassName 1396258.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