Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 OPR/71.0.3770.175
Opera 71
Windows
Desktop
4 years ago
Test name Executions per second
getElementById 967440.6 Ops/sec
jQuery (tag.id) 80834.0 Ops/sec
jQuery (tag#id) 95771.8 Ops/sec
jQuery (.id) 132766.7 Ops/sec
jQuery (#id) 389315.7 Ops/sec
Cash + getElementsByClassName 235751.3 Ops/sec
Cash + getElementById 356353.6 Ops/sec
Cash (tag.id) 143807.1 Ops/sec
jQuery + getElementById 365363.1 Ops/sec
Cash (tag#id) 130739.4 Ops/sec
Cash (#id) 461382.1 Ops/sec
querySelectorAll (.id) 487136.5 Ops/sec
querySelectorAll (#id) 334679.9 Ops/sec
querySelector (.id) 1153391.0 Ops/sec
querySelector (#id) 629176.1 Ops/sec
getElementsByTagName 846125.4 Ops/sec
getElementsByClassName 618945.8 Ops/sec
Cash (.id) 158228.4 Ops/sec
jQuery + getElementsByClassName 147166.9 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