insertAdjacentHTML
JavaScript performance comparison
Info
node.insertAdjacentHTML performance
Preparation code
<div id="work"></div>
<script>
var work = document.getElementById("work");
</script>
<script>
Benchmark.prototype.setup = function() {
while (work.hasChildNodes()){
work.removeChild(work.firstChild);
}
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
insertAdjacentHTML |
|
pending… |
innerHTML |
|
pending… |
appendChild |
|
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
- Revision 2: published
- Revision 3: published by surigami
- Revision 4: published by Stefan Fidanov
- Revision 5: published by Mayhem
- Revision 6: published
- Revision 7: published by Fabiano
- Revision 8: published
- Revision 9: published by AndreasMadsen
1 comment
For a larger chunks of HTML, documentFragment may be used to do the same DOM manipulation over a fragment built off HTML