Concatenating innerHTML + text versus jQuery's append()

Benchmark created by Jelle De Loecker on


Preparation HTML

<div id="contentjq">This is the starter content for jQuery</div>
<div id="contentjs">This is the starter content for javascript</div>
<div id="contentjsi">This is the starter content for javascript v2</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
var jqe = $('#contentjq');
var jse = document.getElementById('contentjs');
var jsi = document.getElementById('contentjsi').innerHTML;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery append
jqe.append('1');
ready
Javascript append
jse.innerHTML += '1';
ready
Javascript append v2
jsi += '1';
ready

Revisions

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

  • Revision 1: published by Jelle De Loecker on
  • Revision 2: published on