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
compare the performance of the simple innerHTML implementation with that of a more complex function using DOMParser.
<script>
const parser = new DOMParser();
const fragment = document.createDocumentFragment();
const parseFromString = (html) => {
const doc = parser.parseFromString(html, 'text/html');
const container = fragment.cloneNode();
while (doc.body.firstChild) {
container.appendChild(doc.body.firstChild);
}
return container;
};
const container = document.createElement('div');
const test = 'toto';
const textNode = document.createTextNode('');
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
innerHTML |
| ready |
DOMParser |
| ready |
TextNode |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.