Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
getElementById 2080740.4 Ops/sec
getElementsByClassName 1604119.0 Ops/sec
getElementsByTagName 1970047.0 Ops/sec
querySelector (#id) 1449984.9 Ops/sec
querySelector (.id) 2184282.8 Ops/sec
querySelectorAll (#id) 906229.1 Ops/sec
querySelectorAll (.id) 1274419.0 Ops/sec
Cash (#id) 1623776.6 Ops/sec
Cash (.id) 829181.1 Ops/sec
Cash (tag#id) 591431.1 Ops/sec
Cash (tag.id) 689382.4 Ops/sec
Cash + getElementById 1043716.2 Ops/sec
Cash + getElementsByClassName 866106.9 Ops/sec
jQuery (#id) 1618101.2 Ops/sec
jQuery (.id) 683728.8 Ops/sec
jQuery (tag#id) 423804.1 Ops/sec
jQuery (tag.id) 485296.5 Ops/sec
jQuery + getElementById 1052349.5 Ops/sec
jQuery + getElementsByClassName 491967.5 Ops/sec
Umbrella(#id) 297542.5 Ops/sec
Umbrella(.id) 310226.7 Ops/sec
Umbrella(tag#id) 294991.4 Ops/sec
Umbrella(tag.id) 305620.8 Ops/sec
Umbrella + getElementById 742867.9 Ops/sec
Umbrella + getElementsByClassName 409588.8 Ops/sec
HTML Preparation code:
Tests:
  • getElementById

  • Umbrella(tag.id)

  • Umbrella(tag#id)

  • Umbrella(.id)

  • Umbrella(#id)

  • jQuery + getElementsByClassName

  • jQuery + getElementById

  • jQuery (tag.id)

  • jQuery (tag#id)

  • jQuery (.id)

  • jQuery (#id)

  • Umbrella + getElementById

  • Cash + getElementsByClassName

  • Cash (tag.id)

  • Cash (tag#id)

  • Cash (.id)

  • Cash (#id)

  • querySelectorAll (.id)

  • querySelectorAll (#id)

  • querySelector (.id)

  • querySelector (#id)

  • getElementsByTagName

  • getElementsByClassName

  • Cash + getElementById

  • Umbrella + getElementsByClassName