convert HTML collection into array

JavaScript performance comparison

Test case created

Preparation code

<input type="text" name="username" value="username"/>
<input type="password" name="password" value"password"/>
<input type="button" value="login"/>
Benchmark.prototype.setup = function() {
    var objs=document.forms[0].elements;;

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
HTML collection
for(var i=0;i<objs.length;i++){
convert HTML collection into Array
for(var i=0;i<objsArray.length;i++){

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Comment form temporarily disabled.

Add a comment