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>
:root {
--sw-backgroundColor: #FFFFFF;
--sw-height: 100px;
--sw-width: 100px;
}
.bg-variable {
background-color: var(--sw-backgroundColor);
width: var(--sw-width);
height: var(--sw-height);
}
</style>
</head>
<body>
<div id="app"></div>
</body>
</html>
function createComponentWithStyleProp() {
const div = document.createElement('div');
div.className = 'bg-variable';
div.style.setProperty('--sw-backgroundColor', '#FF5733');
div.style.setProperty('--sw-width', '120px');
div.style.setProperty('--sw-height', '120px');
document.getElementById('app').appendChild(div);
}
function createComponentWithCSSinJS() {
const div = document.createElement('div');
div.style.backgroundColor = '#FF5733';
div.style.width = '120px';
div.style.height = '120px';
document.getElementById('app').appendChild(div);
}
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.