textContent vs innerHTML

Benchmark created by FGRibreau on


Preparation HTML

<div id="plop"></div>
 
<script>
 var old = document.getElementById('plop');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
innerHTML
old.innerHTML = 'Hello World';
old.innerHTML = 'How are you ?';
ready
textContent
old.textContent = 'Hello World';
old.textContent = 'How are you ?';
ready

Revisions

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

  • Revision 1: published by FGRibreau on