getElementsByClassName[0] vs querySelector (v2)

Revision 2 of this benchmark created on


Preparation HTML

<div>
  <iframe
  id="iframe"
  width="300"
  height="200"
  src="#">
  </iframe>
</div>
<script>
  var nodes;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementsByTagName()[0]
nodes = document.getElementsByTagName("iframe")[0];
ready
querySelector()
nodes = document.querySelector("iframe");
ready
getElementById()
nodes = document.getElementById("iframe");
ready

Revisions

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