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
unique innerHTML vs multiple style.setProperty
<style>
span::after {
content: var(--myvar)
}
</style>
<template id="myTemplate">
<ul>
<li><span>[[myVar]]</span></li>
</ul>
</template>
<div id="testDiv">
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
<ul>
<li><span></span></li>
</ul>
</div>
const nodeElement = document.getElementById('testDiv')
let values = new Array(10).fill('').map(() => Math.random().toString(36).substring(2, 7));
let templateHtml = document.getElementById('myTemplate').innerHTML
let subModules = Array.from(document.getElementsByTagName('span'))
Ready to run.
Test | Ops/sec | |
---|---|---|
Set values with a unique innerHTML |
| ready |
Set values with multiple style.setProperty |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.