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 util = {inherits: function(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}}
function override(parent, fn) {
fn.inherited = parent.prototype[fn.name];
return fn;
}
function ParentClass1(par1, par2) {
this.parentField1 = par1;
this.parentField2 = par2;
}
ParentClass1.prototype.methodName = function(par) {
this.parentField3 = par;
};
function ChildClass1(par1, par2) {
this.constructor.super_.apply(this, arguments);
this.childField1 = par1;
this.childField2 = par2;
}
util.inherits(ChildClass1, ParentClass1);
ChildClass1.prototype.methodName = override(ParentClass1, function methodName(par) {
methodName.inherited.call(this, par);
this.childField3 = par;
});
var _inherits = function (child, parent) {
child.prototype = Object.create(parent && parent.prototype, {
constructor: {
value: child,
enumerable: false,
writable: true,
configurable: true
}
});
if (parent) child.__proto__ = parent;
};
var ParentClass2 = function ParentClass2(par1, par2) {
this.parentField1 = par1;
this.parentField2 = par2;
};
ParentClass2.prototype.methodName = function (par) {
this.parentField3 = par;
};
var ChildClass2 = (function () {
var _ParentClass2 = ParentClass2;
var ChildClass2 = function ChildClass2(par1, par2) {
_ParentClass2.call(this, par1, par2);
this.childField1 = par1;
this.childField2 = par2;
};
_inherits(ChildClass2, _ParentClass2);
ChildClass2.prototype.methodName = function (par) {
_ParentClass2.prototype.methodName.call(this, par);
this.childField3 = par;
};
return ChildClass2;
})();
var inheritance6 = new ChildClass1('Lev', 'Nikolayevich');
var _6to5 = new ChildClass2('Lev', 'Nikolayevich');
var foo;
Ready to run.
Test | Ops/sec | |
---|---|---|
inheritance6 instance |
| ready |
6to5 instance |
| ready |
inheritance6 method |
| ready |
6to5 method |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.