Faster Jquery Append

JavaScript performance comparison

Test case created by Chris

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<div class="element"></div>
    

Preparation code output

<div class="element"></div>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Direct append
for(var i = 0; i < 10; i++)
{
   $(".element").append( $('<div></div>') );
}
pending…
Indirect append
var $temp = $('<div></div>'); 
for(var i = 0; i< 10; i++) 
{ 
   $temp.append( $('<div></div>') );
}
$(".element").append( $temp.children() );
pending…

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

Compare results of other browsers

0 Comments