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
what method for empty a element is faster ?
<div id='wrap'>
<div id='box'></div>
</div>
function write()
{
var box = document.getElementById('box');
var div = document.createElement('div');
div.innerHTML = "halo <br> des <div>aaaa</div><table></table>";
box.appendChild(div);
}
write();
write();
Ready to run.
Test | Ops/sec | |
---|---|---|
remove firstChild |
| ready |
set empty innerHTML |
| ready |
set empty innerText |
| ready |
Test 1, avoiding repaint |
| ready |
cloneNode |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.