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>
.hidden {display: none;}
</style>
<div class="hidden"></div>
<div class="shown"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
var content = '<select>';
for (var i = 0; i < 200; i++)
content += '<option value="'+i+'">'+i+'</option>';
content += '</select>';
var proto = document.createElement("div");
proto.innerHTML = content;
var frag = document.createDocumentFragment();
frag.appendChild(proto.cloneNode(true));
var $proto = $('<div>'+content+'</div>');
var hidden = $('.hidden').get(0);
var shown = $('.shown').get(0);
var detached = document.createElement('div');
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
innerHTML on hidden node |
| ready |
innerHTML on shown node |
| ready |
innerHTML on detached node |
| ready |
cloneNode |
| ready |
cloneNode into new node |
| ready |
cloneNode into detached node |
| ready |
innerHTML on new node |
| ready |
createElement into new node |
| ready |
jQuery parse |
| ready |
jQuery build |
| ready |
jQuery clone |
| ready |
jQuery build appending |
| ready |
cloneNode into new node and update selection |
| ready |
jQuery build with createElement |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.