removeChildren
JavaScript performance comparison
Info
From http://elv1s.ru/files/html+css/removeChildren.html
With an additional test for teh lulz
Preparation code
<script>
var element = document.createElement('div');
function prepareTest() {
var i = 200,
p, j, span;
while (i--) {
p = document.createElement('p');
j = 5;
while (j--) {
span = document.createElement('span');
span.appendChild(document.createTextNode(i * j + 'yada-yada'));
p.appendChild(span);
};
element.appendChild(p);
};
document.body.appendChild(element);
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
innerHTML |
|
pending… |
textContent |
|
pending… |
removeFirstChild |
|
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 Nikita Vasilyev and last updated
- Revision 2: published by Thomas Aylott and last updated
- Revision 3: published by Mathias Bynens
- Revision 7: published
- Revision 8: published by Francis Avila
0 comments