append() vs appendTo()

JavaScript performance comparison

Revision 3 of this test case created by og

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="special_container">
</div>
<script>
  Benchmark.prototype.setup = function() {
    window.str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus quis scelerisque sem. Praesent tempus, turpis in adipiscing semper, tortor tortor adipiscing metus, quis imperdiet magna magna sit amet lectus.";
  };
</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
append()
// async test
$('#special_container')
.empty()
pending…
appendTo
// async test
$('#special_container')
.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