Append on loop (v4)

Revision 4 of this benchmark created by Vassilis Mastorostegios 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
Append inside the loop
for (var i = 0; i < 100; i++) {
  $("#list").append(i + ", ");
};
$('#list').empty();
ready
Append after the loop
var html = "";
for (var i = 0; i < 100; i++) {
  html += i + ", ";
}

$("#list").append(html);
$('#list').empty();
ready
Append to variable
var list = $("#list");
for (var i = 0; i < 100; i++) {
  list.append(i + ", ");
};
$('#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