remove-children

JavaScript performance comparison

Test case created by bjb568

Preparation code

<div id='mydiv'>
Stuffstuffstuff
<ul>
<li>A list</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
<p>
asdfasdf
</p>
</div>
    

Preparation code output

<div id='mydiv'> Stuffstuffstuff <ul> <li>A list</li> <li>2</li> <li>3</li> <li>4</li> </ul> <p> asdfasdf </p> </div>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
innerHTML
document.getElementById('mydiv').innerHTML = '';
pending…
remove firstChild
var last, node = document.getElementById('mydiv');
while (last = node.lastChild) node.removeChild(last);
pending…
textContent
document.getElementById('mydiv').textContent = '';
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.

0 Comments

Stuffstuffstuff

asdfasdf