frag-vs-jquery

JavaScript performance comparison

Test case created

Info

document fragment vs jquery DOM insertion.

Preparation code

<div id="parent"></div>
<script src="//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 Append
for (var i = 0; i < 100; i += 1) {
    $('#parent').append( $('<div>') );
}
pending…
Fragment
var parent = document.getElementById('parent');
var frag = document.createDocumentFragment();
for (var i = 0; i < 100; i += 1) {
    frag.appendChild( document.createElement("div") );
}
parent.appendChild(frag.cloneNode(true));
pending…
Create Element
var parent = document.getElementById('parent');
for (var i = 0; i < 100; i += 1 ) {
    parent.appendChild( document.createElement("div"));
}
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

Add a comment