iterate over htmlcollection (v2)

Revision 2 of this benchmark created on


Setup

var nodes = document.getElementsByTagName('span');
    
    function nop() {}

Test runner

Ready to run.

Testing in
TestOps/sec
standard
var i, len = nodes.length;
for (i = 0; i < len; i++) {
  nop(nodes[i]);
}
ready
coercing
var i = 0,
  node;
while (node = nodes[i++]) {
  nop(node);
}
ready
test
for (var i in nodes)
  nop(nodes[i])
ready

Revisions

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