textContent vs createTextNode() vs innerHTML vs nodeValue (v18)

Revision 18 of this benchmark created on


Description

rev. 2 + nodeValue

Preparation HTML

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

Setup

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

Test runner

Ready to run.

Testing in
TestOps/sec
textContent
div.textContent = '1234';
 
ready
createTextNode()
div.removeChild( div.firstChild );
div.appendChild( document.createTextNode( '1234' ) );
ready
innerHTML
div.innerHTML = '1234';
 
ready
nodeValue
div.firstChild.nodeValue = '1234';
ready
cached textNode
divTextNode.nodeValue = '1234'
ready
innerOlolo
div.innerOlolo = '1234';
ready

Revisions

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