jQuery elementBuilder vs. Clone node

JavaScript performance comparison

Test case created by

Preparation code

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

      
<script>
Benchmark.prototype.setup = function() {
  var body = document.body;

};
</script>

Preparation code output

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
jQuery
var trEl = $('<table><tr><td style="height:0px;width:60px"></td><td style="height:0px;width:2px;"></td><td style="height:0px;width:18px;"></td></tr></table>');

$(body[0]).append(trEl);
$(body[0]).remove(trEl);
pending…
regular JS
var t = document.createDocumentFragment();
var ta = document.createElement('table');
var tr = document.createElement('tr');
var td = document.createElement('td');

tr.appendChild(td.cloneNode());
tr.appendChild(td.cloneNode());
tr.appendChild(td.cloneNode());
ta.appendChild(tr);
var tabl = t.appendChild(ta);

body.appendChild(t);
body.removeChild(tabl);
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.

0 Comments