jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
DOM diff is slow Based on http://jsperf.com/innerhtml-vs-dom-diff/8
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://rawgit.com/fiduswriter/diffDOM/gh-pages/diffDOM.js"></script>
<!-- Existing DOM elements into which the tests will append new content -->
<div id="parent-inner">Replace me via <code>elm.innerHTML</code></div>
<hr/>
<div id="parent-diffhtml">Replace me via <code>$elm.diffhtml()</code></div>
<hr/>
<div id="parent-jquery">Replace me via <code>$elm.html()</code></div>
var inner = document.getElementById('parent-inner');
var $diffhtml = $('#parent-diffhtml');
var $jquery = $('#parent-jquery');
var dd = new diffDOM();
var contentInit = '<div><b>a</b><p>Init element</p><div></div>\</div>';
var contentApply = '<div><i>a</i><p>Applied element</p><div><b>test</b></div></div>';
if (Math.floor(Math.random() * 10) >= 0) contentApply = contentInit;
var $contentInit = $(contentInit)
var $contentApply = $(contentApply)
inner.innerHTML = contentInit;
$diffhtml.html($(contentInit));
$jquery.html(contentInit);
Ready to run.
Test | Ops/sec | |
---|---|---|
innerHtml |
| ready |
DomDiff |
| ready |
jQuery.html |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.