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>
var createTable = (function(){
var d=document;
return function() {
var tr, td, x, y, table = d.createElement('table');
for (y = 0; y < 32; ++y) {
tr = d.createElement('tr');
for (x = 0; x < 32; ++x) {
tr.appendChild(d.createElement('td'));
}
table.appendChild(tr);
}
return table;
};
})();
var cached = createTable();
var sink;
</script>
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.