jquery append with my testing greatness

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

<script src="http://code.jquery.com/jquery-1.7.2.min.js">
</script>
<script>
  var len = 20;
  var si = [];
  for (var i = 0; i < len; i++) {
    si.push($("<p></p>"))
  }
</script>
<div id="addhere">
</div>
<script>
Benchmark.prototype.setup = function() {
    $("#addhere").html("");
};
</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
Test 1
for (var i = 0; i < len; i++) {
  $("addhere").append(si[i]);
}
pending…
Test 2
var html = "";
for (var i = 0; i < len; i++) {
  html += $("<div />").append(si[i]).html();
}
$("addhere").append(html);
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