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
Accurate tests of JavaScript class inheritance models.
These tests aim to provide adequate and accurate results by modelind real-life application behaviour and avoiding common pitfalls. For source code and detailed explanation - please visit the repository:
https://github.com/kogarashisan/PerfTests
Tested libraries does not include Prototype or MooTools, cause they are slow. Ext.JS is not included, cause it affects results of other tests.
<script src="http://kogarashisan.github.io/PerfTests/export/dependencies-v1.js"></script>
<script src="http://kogarashisan.github.io/PerfTests/export/bundle-v1.js"></script>
<script>
!function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.proto=e():r.proto=e()}(this,function(){return function(r){function e(t){if(n[t])return n[t].exports;var o=n[t]={exports:{},id:t,loaded:!1};return r[t].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=r,e.c=n,e.p="",e(0)}([function(r){"use strict";function e(){var r=arguments;if(1==r.length)var p={init:i},s=r[0];else var p=r[0],s=r[1];var v={};-1!==[Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError].indexOf(p)&&(p=n(p,v));var y="function"==typeof p;s[a]=y?p[a]:p;var d=new s(p);v.name=d.name,!d[c]&&y&&(d[c]=function(){p.apply(this,arguments)});var l=function(){};l[a]=d;var m=d.name?d.name:"";if(d[c]===o||d[c]===i)var x=new Function("F","return function "+m+"(){return new F()}")(l);else var x=new Function("F","i","u","n","return function "+m+"(){ var x=new F(),r=i.apply(x,arguments)\nif(r===n)\nreturn x\nelse if(r===u)\nreturn n\nelse\nreturn r\n}")(l,d[c],e[u]);d.constructor=x;for(var g in d)t(x,d,g);for(var g in p)f.call(p,g)&&x[g]===o&&t(x,p,g);return x.parent=p,x[a]=d,x}function n(r,e){function n(){var n=new r(arguments[0]);return n.name=e.name,this.message=n.message,Object.defineProperty?Object.defineProperty(this,"stack",{get:function(){return n.stack}}):this.stack=n.stack,this}var t=function(){};return t.prototype=r.prototype,n.prototype=new t,n}function t(r,e,n){try{var t=Object.getOwnPropertyDescriptor(e,n);t.get!==o||t.get!==o&&Object.defineProperty!==o?Object.defineProperty(r,n,t):r[n]=e[n]}catch(i){}}var o,i=function(){},a="prototype",u="undefined",c="init",f={}.hasOwnProperty;e[u]={},r.exports=e}])});
var ProtoParent = proto(function() {var cache_buster_0502;
this.init = function(instance_string) {var cache_buster_0503;
this.counter = 0;
this.instance_array = [];
this.instance_string = instance_string;
};
this.method = function (prevent_inline) {var cache_buster_0504;
if (this.counter > 99)
this.counter = this.counter / 2;
else
this.counter++;
if (prevent_inline) {
var i = 0;
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
for (i = 0; i < 1; i++) dummy.method();
}
}
});
var ProtoChildA = proto(ProtoParent, function(superclass) {var cache_buster_0505;
this.init = function(instance_string) {var cache_buster_0506;
this.member_a = 1;
superclass.init.call(this, instance_string);
};
this.method = function() {var cache_buster_0507;
this.member_a = -this.member_a;
superclass.method.call(this, false);
}
});
var ProtoChildB = proto(ProtoParent, function(superclass) {var cache_buster_0508;
this.init = function(instance_string) {var cache_buster_0509;
this.member_b = -1;
superclass.init.call(this, instance_string);
};
this.method = function() {var cache_buster_0510;
this.member_b = -this.member_b;
superclass.method.call(this, false);
}
});
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
TypeScript |
| ready |
ClassManager / Browser / Monomorphic |
| ready |
ClassManager / Browser / Polymorphic |
| ready |
ClassManager / Server / Monomorphic / Full |
| ready |
ClassManager / Server / Monomorphic / Partial |
| ready |
ClassManager / Server / Polymorphic / Partial |
| ready |
DotNetWise inheritWith |
| ready |
DotNetWise fastClass |
| ready |
Fiber |
| ready |
John Resig |
| ready |
Native |
| ready |
Proto |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.