getElementById vs. querySelector (v189)

Revision 189 of this benchmark created by Saroyanm on


Description

Compare the speed of getElementById to querySelector

Preparation HTML

<p id="bar">
<p id="foo">Foo</p>
</p>
<p id="baz">Baz</p>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
var bar = document.getElementById("bar");
ready
querySelector
var bar = document.querySelector("#bar");
ready

Revisions

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