querySelectorAll vs getElementsByTagName (v95)

Revision 95 of this benchmark created by Yaroslaff Fedin on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
querySelector
var nodes = document.querySelector('a#test')
ready
getElementsByTagName
var nodes = document.getElementsByTagName('a')['test']
ready

Revisions

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