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
Speed testing for a function in https://github.com/ottypes/rich-text
var is = {
object: function (value) {
if (!value) return false;
return (typeof value === 'function' || typeof value === 'object');
},
}
var defaultClone = function (attributes, keepNull) {
if (!is.object(attributes)) return {};
return Object.keys(attributes).reduce(function (memo, key) {
if (attributes[key] !== undefined && (attributes[key] !== null || keepNull)) {
memo[key] = attributes[key];
}
return memo;
}, {});
}
var loopClone = function (attributes, keepNull) {
var target = {};
if (!is.object(attributes)) return target;
for (var key in attributes) {
if (attributes[key] !== undefined && (attributes[key] !== null || keepNull)) {
target[key] = attributes[key];
}
}
return target;
}
var testObject = { bold: true, underline: null, random:'foobar',color: Math.floor(Math.random()*40)};
Ready to run.
Test | Ops/sec | |
---|---|---|
Default Functional |
| ready |
Loop |
| ready |
Default Functional Null |
| ready |
Loop Clone Null |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.