Document.body vs document.getElementsByTagName('body')[0] (v5)

Revision 5 of this benchmark created by John Michel on


Test runner

Ready to run.

Testing in
TestOps/sec
document.body
var body = document.body;
ready
document.getElementsByTagName('body')[0]
var body2 = document.getElementsByTagName('body')[0];
ready
document.querySelector('body')
var body3 = document.querySelector('body');
ready

Revisions

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