document.head (v2)

Revision 2 of this benchmark created by Charles Lehner on


Description

How much faster is the HTML5 document.head DOM tree accessor compared to its old-school variant, document.getElementsByTagName('head')[0]?

Preparation HTML

<script>
  document.head = document.head || document.getElementsByTagName('head')[0];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
document.getElementsByTagName('head')[0]
document.getElementsByTagName('head')[0];
ready
document.head
document.head;
ready
document.documentElement.firstChild
document.documentElement.firstChild;
ready

Revisions

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

  • Revision 1: published by Mathias Bynens on
  • Revision 2: published by Charles Lehner on
  • Revision 3: published by kangax on
  • Revision 4: published by stefaan on
  • Revision 5: published on
  • Revision 6: published on
  • Revision 7: published by Ryun shofner on