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
Tests various DOM construction patterns.
<style>
.destination {display: none;}
</style>
<div id="destination1" class="destination"></div>
<div id="destination2" class="destination"></div>
<div id="destination3" class="destination"></div>
<div id="destination4" class="destination"></div>
<div id="destination5" class="destination"></div>
<script>
var content = '<div class="test"><span style="color: red">Wooo Text!</span></div><div>More text!</div>',
dest1 = document.getElementById("destination1"),
dest2 = document.getElementById("destination2"),
dest3 = document.getElementById("destination3"),
dest4 = document.getElementById("destination4"),
dest5 = document.getElementById("destination5");
// For Element cloneNode test
var womb = document.createElement("div");
womb.innerHTML = content;
// For doc fragment test
var frag = document.createDocumentFragment(),
clone = womb.cloneNode(true),
len = clone.childNodes.length;
while (len--) {
frag.appendChild(clone.childNodes[0]);
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
innerHTML |
| ready |
cloneNode |
| ready |
DocumentFragment |
| ready |
DOM post insert |
| ready |
DOM pre insert |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.