HTML element creation test

JavaScript performance comparison

Test case created by Hitesh Aneja

Preparation code

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

<div id="myDiv"></div>
<script>
Benchmark.prototype.setup = function() {
    var 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
string operation
html = "<div id='myId'>";
html += "Parent Div";
html += "<div id='myId'>child div</div>";
html += "</div>";
$("#myDiv").html(html);
pending…
with functions
var container = $(document.createElement("div"))
container.html("parent div");
var child = $(document.createElement("div"));
child.html("child div");
container.append(child);
pending…

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

Compare results of other browsers

0 comments

Add a comment