Creating complex elements

JavaScript performance comparison

Test case created by WTK

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></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
Passing full html string to jQuery
var elements = "<div><table><tr><td>1</td><td>2</td></tr></table></div>";
$("body").append($(elements));
pending…
Create elements by hand but still using jQuery
function create() {
  return $("<div>").append($("<table>").append('tr').append('td'));
}
$("body").append(create());
pending…
Using innerHTML
var elements = "<div><table><tr><td>1</td><td>2</td></tr></table></div>";
var div = document.createElement('div')
div.id = 'mycustomdiv'
document.getElementsByTagName('body')[0].appendChild(div);
div.innerHTML = elements;
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:

1 comment

xyz commented :

Good Result!

Add a comment