getElementById vs querySelector (v9)

Revision 9 of this benchmark created on


Preparation HTML

<p class="foo">Foo</p>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
document.getElementsByClassName("foo");
ready
querySelector("#foo")
document.querySelector(".foo");
ready
querySelector("[id=elem]");
document.querySelector("[class=foo]");
ready

Revisions

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