textContent vs createTextNode() vs innerHTML (v22)

Revision 22 of this benchmark created on


Preparation HTML

<div id="placehere"></div>

<script>
var target = document.getElementById( 'placehere' )
,   el
,   tn
; 
</script>

Setup

target.innerHTML = '';

Teardown


    target.innerHTML = '';
  

Test runner

Ready to run.

Testing in
TestOps/sec
innerText
el = document.createElement( 'p' );
el.textContent = "THIS IS A TEST";
target.appendChild( el );
ready
createTextNode()
el = document.createElement( 'p' );
tn = document.createTextNode('THIS IS A TEST');
el.appendChild( tn );
target.appendChild( el );
ready
innerHTML
div.innerHTML = '1234';
 
ready

Revisions

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