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
<!DOCTYPE html>
<html>
<head>
<style>
.xyz {
--sw-backgroundColor: #FFFFFF;
--sw-height: 100px;
--sw-width: 100px;
}
.bg {
background-color: var(--sw-backgroundColor);
}
.wd {
width: var(--sw-width);
}
.h {
height: var(--sw-height);
}
</style>
</head>
<body>
<div id="app"></div>
<div id="app" style="" class="wd bg h"></div>
</body>
</html>
function createComponentWithStyleProp() {
document.getElementById('app').className = 'xyz wd bg h';
}
function createComponentWithCSSinJS() {
const div = document.getElementById('app');
div.style.setProperty('--sw-backgroundColor', '#FFFFFF');
div.style.setProperty('--sw-width', '100px');
div.style.setProperty('--sw-height', '100px');
div.className = 'wd bg h';
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Inline |
| ready |
JS |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.