querySelectorAll2

JavaScript performance comparison

Revision 10 of this test case created by

Preparation code

<div class="a">
        <div class="a">
                <div class="b" id="MyDiv" key="mm"></div>
                <div class="c"></div>
                <div class="c"></div>
                <div class="c"></div>
                <div class="a"></div>
                <div key="mm"></div>
        </div>
</div>
    

Preparation code output

<div class="a"> <div class="a"> <div class="b" id="MyDiv" key="mm"></div> <div class="c"></div> <div class="c"></div> <div class="c"></div> <div class="a"></div> <div key="mm"></div> </div> </div>

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
getElementById
var a = document.getElementById('MyDiv');
pending…
getElementsByClassName
var els = document.getElementsByClassName('.b');
pending…
querySelectorAll ID
var els = document.querySelectorAll("#MyDiv");
pending…
querySelectorAll class
var els = document.querySelectorAll(".b");
pending…
querySelector ID
var els = document.querySelector("#MyDiv");
pending…
querySelector class
var els = document.querySelector(".b");
pending…
querySelectorAll key
var els = document.querySelectorAll("div[key='mm']");
pending…
getElementsByTagName
var els = document.getElementsByTagName("div");
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