getElementsByTagName vs document.scripts

Benchmark created on


Description

getElementsByTagName('script') vs document.scripts

Preparation HTML

<html>
<head>
<script>var a,b,c; function bla(e){console.log(e)} bla('foo');</script>
<script src='lib0.js'></script>
<script src='lib2.js'></script>
<script src='lib3.js'></script>
</head>
<body>
<script src='lib4.js'></script>
<script src='lib5.js'></script>
<script src='lib6.js'></script>
<script src='lib7.js'></script>
<script src='lib8.js'></script>
<script src='lib9.js'></script>
</body>
</html>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementsByTagName
var scripts = document.getElementsByTagName('script');
ready
document.scripts
var scripts = document.scripts;
ready

Revisions

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