getElementById vs. querySelector (v110)

Revision 110 of this benchmark created on


Description

Compare the speed of querySelector and to getElementsByClassName

Preparation HTML

<p class="foo">Foo</p>
<p class="bar">Bar</p>
<p class="baz">Baz</p>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementByClassName
var bar = document.getElementsByClassName("bar");
ready
querySelector
var bar = document.querySelectorAll(".bar");
ready

Revisions

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