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
<script>
function inherit(ctor, super_) {
ctor.super_ = super_;
ctor.prototype = Object.create(super_.prototype);
}
function mkChild(super_) {
function child() {
super_.call(this);
}
inherit(child, super_);
return child;
}
function Parent() {
this.prop = 0;
}
Parent.prototype.incProp = function() {
this.prop++;
};
var children = [];
for (var i = 0; i < 10; i++) {
var ctor = mkChild(Parent);
children.push(new ctor());
}
function Part() {
this.prop = 0;
}
Part.prototype.incProp = function() {
this.prop++;
};
function mkWhole() {
function Whole() {
this.part = new Part();
}
Whole.prototype.incProp = function() {
this.part.incProp();
};
return Whole;
}
var wholes = [];
for (var i = 0; i < 10; i++) {
var ctor = mkWhole();
wholes.push(new ctor());
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
inheritance |
| ready |
aggregation |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.