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

Latest run results:
Run details: (Test run date: 5 days ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.108 Safari/537.36
Chrome 84 on Linux
View result in a separate tab
Test name Executions per second
getElementById 1279287.0 Ops/sec
jQuery (tag.id) 188398.3 Ops/sec
jQuery (tag#id) 176748.8 Ops/sec
jQuery (.id) 234607.0 Ops/sec
jQuery (#id) 779962.6 Ops/sec
Cash + getElementsByClassName 420529.8 Ops/sec
Cash + getElementById 589661.9 Ops/sec
Cash (tag.id) 257192.8 Ops/sec
jQuery + getElementById 609428.5 Ops/sec
Cash (tag#id) 229755.8 Ops/sec
Cash (#id) 827732.5 Ops/sec
querySelectorAll (.id) 712174.3 Ops/sec
querySelectorAll (#id) 473146.4 Ops/sec
querySelector (.id) 1302288.0 Ops/sec
querySelector (#id) 656901.6 Ops/sec
getElementsByTagName 1008436.0 Ops/sec
getElementsByClassName 880553.6 Ops/sec
Cash (.id) 317800.8 Ops/sec
jQuery + getElementsByClassName 238628.2 Ops/sec

Recommended literature: