byClassName vs querySelectorAll 2

JavaScript performance comparison

Revision 10 of this test case created by

Preparation code

<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" />
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" />
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" />
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" />
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" />
<div class="rwdimage"></div>
<div class="rwdimage"></div>
<div class="rwdimage"></div>
<div class="rwdimage"></div>
<div class="rwdimage"></div>
    

Preparation code output

<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" /> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" /> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" /> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" /> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEHAAAALAAAAAABAAEAAAICRAEAOw==" class="rwdimage" /> <div class="rwdimage"></div> <div class="rwdimage"></div> <div class="rwdimage"></div> <div class="rwdimage"></div> <div class="rwdimage"></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
getElementsByClassName
var elems = document.getElementsByClassName('rwdimage');
pending…

Revisions

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

0 Comments