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: 3 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.51 Safari/537.36
Chrome 96 on Windows
View result in a separate tab
Test name Executions per second
getElementById 2783042.0 Ops/sec
jQuery (tag.id) 297445.8 Ops/sec
jQuery (tag#id) 286293.0 Ops/sec
jQuery (.id) 416009.9 Ops/sec
jQuery (#id) 1395109.0 Ops/sec
Cash + getElementsByClassName 785764.4 Ops/sec
Cash + getElementById 1029780.0 Ops/sec
Cash (tag.id) 558137.9 Ops/sec
jQuery + getElementById 1121166.0 Ops/sec
Cash (tag#id) 460656.4 Ops/sec
Cash (#id) 1499680.0 Ops/sec
querySelectorAll (.id) 1365737.0 Ops/sec
querySelectorAll (#id) 801305.9 Ops/sec
querySelector (.id) 2521291.0 Ops/sec
querySelector (#id) 1520163.0 Ops/sec
getElementsByTagName 2294518.0 Ops/sec
getElementsByClassName 1909624.0 Ops/sec
Cash (.id) 671716.3 Ops/sec
jQuery + getElementsByClassName 484695.3 Ops/sec