Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36
Chrome 94
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
getElementById 3321631.2 Ops/sec
jQuery (tag.id) 450964.1 Ops/sec
jQuery (tag#id) 424742.3 Ops/sec
jQuery (.id) 642206.8 Ops/sec
jQuery (#id) 1635039.1 Ops/sec
Cash + getElementsByClassName 986345.7 Ops/sec
Cash + getElementById 1210461.2 Ops/sec
Cash (tag.id) 656624.9 Ops/sec
jQuery + getElementById 1369308.4 Ops/sec
Cash (tag#id) 520744.8 Ops/sec
Cash (#id) 1837361.5 Ops/sec
querySelectorAll (.id) 1547573.9 Ops/sec
querySelectorAll (#id) 1015304.2 Ops/sec
querySelector (.id) 3328544.2 Ops/sec
querySelector (#id) 1774172.9 Ops/sec
getElementsByTagName 2577839.2 Ops/sec
getElementsByClassName 2216514.8 Ops/sec
Cash (.id) 809681.4 Ops/sec
jQuery + getElementsByClassName 548981.2 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