document.images vs getElementsByTagName('img')

Benchmark created by Martin Borthiry on


Description

Is document.getElementsByTagName('img').length faster than document.images.length?

Preparation HTML

<img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" /><img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" />

Test runner

Ready to run.

Testing in
TestOps/sec
getElementsByTagName
document.getElementsByTagName('img').length;
ready
document.images
document.images.length;
ready

Revisions

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