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
var random = Math.random();
// TraditionalPrototypeClass
function TraditionalPrototypeClass() {
}
TraditionalPrototypeClass.prototype.foo = function() {
return random + 1;
};
TraditionalPrototypeClass.prototype.bar = function() {
return random + 1;
};
TraditionalPrototypeClass.prototype.toFooBarOrNotToFooBarQuestion = function() {
return random + 1;
};
// ModulePatternClass
function ModulePatternClass() {
this.foo = function() {
return random + 1;
};
this.bar = function() {
return random + 1;
};
this.toFooBarOrNotToFooBarQuestion = function() {
return random + 1;
};
}
// ModuleCachePatternClass
var ModuleCachePatternClass = (function () {
function foo() {
return random + 1;
}
function bar() {
return random + 1;
}
function toFooBarOrNotToFooBarQuestion() {
return random + 1;
}
return function () {
this.foo = foo;
this.bar = toFooBarOrNotToFooBarQuestion;
this.toFooBarOrNotToFooBarThatIsTheQuestion = bar;
};
}());
Ready to run.
Test | Ops/sec | |
---|---|---|
Prototype Short Name |
| ready |
Prototype Long Name |
| ready |
Short to Long Name |
| ready |
Long to Short Name |
| ready |
Long Name |
| ready |
Short Name |
| ready |
Module Long Name |
| ready |
Module Short Name |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.