Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Chrome 111
Windows
Desktop
one year ago
Test name Executions per second
getElementById 10446019.0 Ops/sec
jQuery (tag.id) 706927.8 Ops/sec
jQuery (tag#id) 649675.6 Ops/sec
jQuery (.id) 1295948.1 Ops/sec
jQuery (#id) 2246432.2 Ops/sec
Cash + getElementsByClassName 1974621.4 Ops/sec
Cash + getElementById 3496485.0 Ops/sec
Cash (tag.id) 1706211.2 Ops/sec
jQuery + getElementById 2856120.2 Ops/sec
Cash (tag#id) 1588290.9 Ops/sec
Cash (#id) 3734392.5 Ops/sec
querySelectorAll (.id) 3089491.5 Ops/sec
querySelectorAll (#id) 2553419.0 Ops/sec
querySelector (.id) 6616596.5 Ops/sec
querySelector (#id) 5110463.0 Ops/sec
getElementsByTagName 8491521.0 Ops/sec
getElementsByClassName 5894518.0 Ops/sec
Cash (.id) 2543701.5 Ops/sec
jQuery + getElementsByClassName 981642.4 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


;