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
I need to store a copy of CSSStyleDeclaration.
There are multiple ways to clone it:
Some browsers has buggy implementations that break the graphs, so results are validated.
window.computed = window.getComputedStyle(document.body);
window.clonedTarget = {};
var c=0, err=[];
for(var attr in clonedTarget){
if(clonedTarget.hasOwnProperty(attr) && (clonedTarget[attr] != computed[attr])){
err.push('ERROR: ' + attr + ': '+ clonedTarget[attr] + '!=' + computed[attr]);
};
c++;
}
if(c<computed.length){
err.push('ERROR: less elements on clonedTarget (' + c + ') than found on computed (' + computed.length + ')');
}
if(err.length){
throw err;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Enumerate all non-numeric attributes |
| ready |
Splitting cssText results |
| ready |
by enumerating digit attributes |
| ready |
by enumerating digit attributes (as an array) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.