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

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    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

    Fastest: N/A

    Slowest: N/A

Get performance results from real users on your website with Request Metrics.
Latest run results:
Run details: (Test run date: 5 months ago)
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 on Windows
View result in a separate tab
Test name Executions per second
getElementById 2224635.0 Ops/sec
jQuery (tag.id) 498251.5 Ops/sec
jQuery (tag#id) 437097.8 Ops/sec
jQuery (.id) 715300.1 Ops/sec
jQuery (#id) 1676096.0 Ops/sec
Cash + getElementsByClassName 868593.3 Ops/sec
Cash + getElementById 1071139.0 Ops/sec
Cash (tag.id) 716189.8 Ops/sec
jQuery + getElementById 1103736.0 Ops/sec
Cash (tag#id) 611385.0 Ops/sec
Cash (#id) 1807521.0 Ops/sec
querySelectorAll (.id) 1168492.0 Ops/sec
querySelectorAll (#id) 871966.6 Ops/sec
querySelector (.id) 2364271.0 Ops/sec
querySelector (#id) 1606698.0 Ops/sec
getElementsByTagName 2081679.0 Ops/sec
getElementsByClassName 1760381.0 Ops/sec
Cash (.id) 876896.8 Ops/sec
jQuery + getElementsByClassName 519339.8 Ops/sec