querySelectorAll vs getElementsByTagName (v63)

Revision 63 of this benchmark created on


Preparation HTML

<div>
  <ul>
    <li><a href="#">item 1</a></li>
    <li><a href="#">item 2</a></li>
    <li><a href="#">item 3</a></li>
  </ul>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
querySelectorAll
var i, item, count, nodes = document.querySelectorAll('a');

for(i=0; item = nodes[i++];) if(item.tagName) count++;
ready
getElementsByTagName
var i, item, count, nodes = document.getElementsByTagName('*','a');

for(i=0; item = nodes[i++];) if(item.tagName) count++;
ready

Revisions

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