Document fragment vs html element append
JavaScript performance comparison
Preparation code
<ul id="container">
</ul>
<script>
Benchmark.prototype.setup = function() {
var ITERATIONS = 1000;
var container = document.getElementById("container");
};
Benchmark.prototype.teardown = function() {
container.innerHTML = "";
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
HTML append |
|
pending… |
Fragment append |
|
pending… |
innerHTML |
|
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:
- Revision 1: published by Justin Johnson
- Revision 3: published by Simo
- Revision 4: published by Matthew Miller
- Revision 5: published by Matthew Miller
- Revision 6: published by Rajesh Jagannathan
- Revision 7: published
0 comments