textContent vs createTextNode() vs innerHTML (v3)

Revision 3 of this benchmark created on


Preparation HTML

<div id="div">asdfghkkl</div>

Setup

var div = document.getElementById( 'div' ), i = 10;
    div.innerHTML = '';

Test runner

Ready to run.

Testing in
TestOps/sec
textContent
while (--i) div.textContent += '1234'+i;
 
ready
createTextNode()
while (--i) div.appendChild( document.createTextNode( '1234'+i ) );
ready
innerHTML
while (--i) div.innerHTML += '1234'+i;
 
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.