getElementById cached vs. dynamic (v2)

Revision 2 of this benchmark created by Chin on


Preparation HTML

<a id="test_link">Test Link</a>

Setup

var link = document.getElementById("test_link");
    
    var getElem = document.getElementById;

Test runner

Ready to run.

Testing in
TestOps/sec
Don't cache
document.getElementById("test_link").click();
ready
Cache
link.click();
ready
cache function
getElem("test_link").click();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.