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: 4 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36
Chrome 86 on Windows
View result in a separate tab
Test name Executions per second
getElementById 3308973.0 Ops/sec
jQuery (tag.id) 455536.9 Ops/sec
jQuery (tag#id) 439030.9 Ops/sec
jQuery (.id) 596702.9 Ops/sec
jQuery (#id) 1849000.0 Ops/sec
Cash + getElementsByClassName 952239.0 Ops/sec
Cash + getElementById 1270568.0 Ops/sec
Cash (tag.id) 550948.0 Ops/sec
jQuery + getElementById 1343064.0 Ops/sec
Cash (tag#id) 477472.8 Ops/sec
Cash (#id) 2072963.0 Ops/sec
querySelectorAll (.id) 1847041.0 Ops/sec
querySelectorAll (#id) 1193281.0 Ops/sec
querySelector (.id) 3200426.0 Ops/sec
querySelector (#id) 1995931.0 Ops/sec
getElementsByTagName 2717651.0 Ops/sec
getElementsByClassName 2158843.0 Ops/sec
Cash (.id) 669363.0 Ops/sec
jQuery + getElementsByClassName 562863.8 Ops/sec

Recommended literature: