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 3455212.0 Ops/sec
jQuery (tag.id) 434950.3 Ops/sec
jQuery (tag#id) 430571.2 Ops/sec
jQuery (.id) 563511.6 Ops/sec
jQuery (#id) 1869852.1 Ops/sec
Cash + getElementsByClassName 1052957.1 Ops/sec
Cash + getElementById 1385426.1 Ops/sec
Cash (tag.id) 567076.7 Ops/sec
jQuery + getElementById 1474016.5 Ops/sec
Cash (tag#id) 515176.4 Ops/sec
Cash (#id) 2115761.2 Ops/sec
querySelectorAll (.id) 1436638.9 Ops/sec
querySelectorAll (#id) 1253756.6 Ops/sec
querySelector (.id) 3576859.5 Ops/sec
querySelector (#id) 2313184.2 Ops/sec
getElementsByTagName 2882534.0 Ops/sec
getElementsByClassName 2407207.8 Ops/sec
Cash (.id) 707573.9 Ops/sec
jQuery + getElementsByClassName 598193.1 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