detach vs normal append

Benchmark created by pnannuru on


Description

tetsing the detach.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> 
 <div class="tm">
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                        <thead>
                            <tr>
                                <th>COMMON</th>                    
                            </tr>
                        </thead>
                        <tbody id="loanDocs">
                                                        
                        </tbody>
                    </table>
                </div>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery deatch
$(document).ready(function() {

 var insertHtml = '<li class="last"><a href="javascript:;">MORE</a></li>';
 var $docHTML = $("#loanDocs").detach();
 var li = "";

 for (i = 0; i < 10; i++) {
  li += "<li>This is list item " + i + "</li>";
 }

 $docHTML.append(li);


});
ready
normal append
$(document).ready(function() {

 var insertHtml = '<li class="last"><a href="javascript:;">MORE</a></li>';
 var $docHTML = $("#loanDocs");
 var li = "";

 for (i = 0; i < 10; i++) {
  li += "<li>This is list item " + i + "</li>";
 }

 $docHTML.append(li);


});
ready
normal java script
window.onload = function() {
 var insertHtml = '<li class="last"><a href="javascript:;">MORE</a></li>';
 var docHTML = document.getElementById("loanDocs");
 var li = "";

 for (i = 0; i < 10; i++) {
  li += "<li>This is list item " + i + "</li>";
 }

 docHTML.innerHTML += li;

}
ready

Revisions

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