textContent vs createTextNode() vs innerHTML (v7)

Revision 7 of this benchmark created on


Preparation HTML

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

Setup

var div = document.getElementById( 'div' );

Test runner

Ready to run.

Testing in
TestOps/sec
innerText
div.innerText= '1234';
 
ready
createTextNode()
div.removeChild( div.firstChild );
div.appendChild( document.createTextNode( '1234' ) );
ready
innerHTML
div.innerHTML = '1234';
 
ready
data
div.firstChild.data = '1234';
ready

Revisions

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