Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 2157032.2 Ops/sec
jQuery (tag.id) 276789.0 Ops/sec
jQuery (tag#id) 250932.7 Ops/sec
jQuery (.id) 328117.7 Ops/sec
jQuery (#id) 1007164.2 Ops/sec
Cash + getElementsByClassName 559410.3 Ops/sec
Cash + getElementById 807188.5 Ops/sec
Cash (tag.id) 336899.4 Ops/sec
jQuery + getElementById 795790.4 Ops/sec
Cash (tag#id) 334830.2 Ops/sec
Cash (#id) 1379662.9 Ops/sec
querySelectorAll (.id) 1116233.4 Ops/sec
querySelectorAll (#id) 773067.4 Ops/sec
querySelector (.id) 2014324.5 Ops/sec
querySelector (#id) 1313304.0 Ops/sec
getElementsByTagName 1831510.9 Ops/sec
getElementsByClassName 1506085.9 Ops/sec
Cash (.id) 419547.2 Ops/sec
jQuery + getElementsByClassName 370386.3 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