jquery vs createElement

JavaScript performance comparison

Revision 132 of this test case created by Shubhan

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 

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
jquery
for (var categoryIndex=0; categoryIndex < 45; categoryIndex++)
    {
var test = $('<span>');
  var tableBody           = $("<TBODY>");
var currentRow = $("<TR>").css("height", "20px");
$(tableBody).append(currentRow);
  var tableLayout = $("<TABLE>").attr({ width: "100%", cellPadding: 0, cellSpacing: 0, border: 0, "PropertySheetTable": "" });

            var rowLayout   = $("<TR>");

            var bodyLayout  = $("<TBODY>").append(rowLayout)
                                         .appendTo(tableLayout);
 var currentCell = $("<TD>").attr({ colspan: 3 })
                                   .appendTo(currentRow)
                                   .append(tableLayout);
}
pending…
createElement

for (var categoryIndex=0; categoryIndex < 45; categoryIndex++)
    {var test = $(document.createElement('span'));
 var tableBody           = document.createElement("TBODY");
 var currentRow           = document.createElement("TR");
 tableBody.appendChild(currentRow);
 var tableLayout = document.createElement("TABLE");
            var bodyLayout  = document.createElement("TBODY");
            var rowLayout   = document.createElement("TR");

            var currentCell         = document.createElement("TD");
       
         
            currentRow.appendChild(currentCell);
            currentCell.appendChild(tableLayout);
            tableLayout.appendChild(bodyLayout);
            bodyLayout.appendChild(rowLayout);
}
pending…

Compare results of other browsers

Revisions

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:

0 comments

Comment form temporarily disabled.

Add a comment