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
When creating many elements that are exactly the same, is it faster to create all manually or to create one and cloneNode() the rest?
<script>
function createTable() {
var tr, td, x, y, table = document.createElement('table');
for (y = 0; y < 32; ++y) {
tr = document.createElement('tr');
for (x = 0; x < 32; ++x) {
td = document.createElement('td');
tr.appendChild(td);
}
table.appendChild(tr);
}
return table;
}
</script>
var tables = new Array(100),
len = tables.length;
Ready to run.
Test | Ops/sec | |
---|---|---|
createElement |
| ready |
cloneNode |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.