querySelectorAll vs. getElementsByTagName

JavaScript performance comparison

Revision 156 of this test case created by

Preparation code

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

Preparation code output

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

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
getElementsByTagName
var bar = document.getElementsByTagName("p")[0];
pending…
querySelectorAll
var bar = document.querySelectorAll("p")[0];
pending…

Compare results of other browsers

Revisions

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

0 Comments

Foo

Bar

Baz