Append on loop

Benchmark created by DareBoost on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
Inside the loop
for (var i = 0; i < 100; i++) {
  $("#list").append(i + ", ");
};
$('#list').empty();
ready
Outside the loop
var html = "";
for (var i = 0; i < 100; i++) {
  html += i + ", ";
}

$("#list").append(html);
$('#list').empty();
ready

Revisions

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

  • Revision 1: published by DareBoost on
  • Revision 2: published by DareBoost on
  • Revision 3: published by Zander on
  • Revision 4: published by Vassilis Mastorostegios on