document.head (v4)

Revision 4 of this benchmark created by stefaan on


Description

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

Test runner

Ready to run.

Testing in
TestOps/sec
headByAccessor
(document.head || document.getElementsByTagName('head')[0]).firstChild;
ready
headByTag
document.getElementsByTagName('head')[0].firstChild;
ready
scriptByTag
document.getElementsByTagName('script')[0];
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