Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
Chrome 85
Mac OS X 10.15.6
Desktop
4 years ago
Test name Executions per second
getElementById 2643211.8 Ops/sec
jQuery (tag.id) 351785.1 Ops/sec
jQuery (tag#id) 305687.4 Ops/sec
jQuery (.id) 494919.4 Ops/sec
jQuery (#id) 1342047.0 Ops/sec
Cash + getElementsByClassName 845531.4 Ops/sec
Cash + getElementById 1103721.9 Ops/sec
Cash (tag.id) 422952.2 Ops/sec
jQuery + getElementById 1114706.9 Ops/sec
Cash (tag#id) 381581.5 Ops/sec
Cash (#id) 1670748.2 Ops/sec
querySelectorAll (.id) 1271197.1 Ops/sec
querySelectorAll (#id) 950523.6 Ops/sec
querySelector (.id) 2804203.2 Ops/sec
querySelector (#id) 1448627.6 Ops/sec
getElementsByTagName 1800544.4 Ops/sec
getElementsByClassName 1687207.6 Ops/sec
Cash (.id) 557686.1 Ops/sec
jQuery + getElementsByClassName 435362.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