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 __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var BaseClass = (function () {
function BaseClass(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
BaseClass.prototype.getFirstName = function () {
return this.firstName;
};
BaseClass.prototype.getLastName = function () {
return this.lastName;
};
return BaseClass;
}());
var Person = (function (_super) {
__extends(Person, _super);
function Person() {
return _super.apply(this, arguments) || this;
}
Person.prototype.getFullName = function () {
return this.firstName + ' ' + this.lastName;
};
return Person;
}(BaseClass));
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var BaseClass2 = function () {
function BaseClass2(firstName, lastName) {
_classCallCheck(this, BaseClass2);
this.firstName = firstName;
this.lastName = lastName;
}
_createClass(BaseClass2, [{
key: 'getFirstName',
value: function getFirstName() {
return this.firstName;
}
}, {
key: 'getLastName',
value: function getLastName() {
return this.lastName;
}
}]);
return BaseClass2;
}();
var Person2 = function (_BaseClass) {
_inherits(Person2, _BaseClass);
function Person2() {
_classCallCheck(this, Person2);
return _possibleConstructorReturn(this, (Person2.__proto__ || Object.getPrototypeOf(Person2)).apply(this, arguments));
}
_createClass(Person2, [{
key: 'getFullName',
value: function getFullName() {
return this.firstName + ' ' + this.lastName;
}
}]);
return Person2;
}(BaseClass2);
Ready to run.
Test | Ops/sec | |
---|---|---|
new TS Person |
| ready |
new Babel Person |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.