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
Performance of LiquidLava generated classes is comparable to their hand-written analogues.
<!-- Standalone version of ClassManager -->
<!-- https://github.com/kogarashisan/ClassManager -->
<script src="https://dl.dropboxusercontent.com/u/3554716/jsperf/lava-class-manager.js"></script>
<script>
///////////////////////////////////////////////////////////////////
// create classes in traditional way
function NativeParentClass() { this.counter = 0; }
NativeParentClass.prototype.method = function() { this.counter++; }
function NativeChildClass() {}
NativeChildClass.prototype = new NativeParentClass();
NativeChildClass.prototype.method = function() {
NativeParentClass.prototype.method.call(this);
}
var NativeInstance = new NativeChildClass();
///////////////////////////////////////////////////////////////////
// Create classes via Lava.ClassManager
Lava.ClassManager.registerRootNamespace('window', window);
Lava.ClassManager.define(
'window.LavaParentClass',
{
counter: 0,
method: function() { this.counter++; }
});
Lava.ClassManager.define(
'window.LavaChildClass',
{
Extends: 'window.LavaParentClass',
method: function() { this.LavaParentClass$method(); }
});
var LavaInstance = new LavaChildClass();
var LavaInstance1 = new LavaChildClass();
var LavaInstance2 = new LavaChildClass();
///////////////////////////////////////////////////////////////////
// the same classes, but generated on server
Lava.ClassManager.loadClass({
name: "LavaServerParent",
path: "window.LavaServerParent",
level: 0,
"extends": null,
"implements": [],
hierarchy_paths: ["window.LavaServerParent"],
parent_class_data: null,
prototype_generator: function(cd,p) {
var r=cd.references,
s=cd.shared;
p.Class = cd;
p.counter = 0;
p.method = r[0];
},
shared: {},
references: [function () { this.counter++; }],
constructor: function() {}
});
Lava.ClassManager.loadClass({
name: "LavaServerChild",
path: "window.LavaServerChild",
level: 1,
"extends": "window.LavaServerParent",
"implements": [],
hierarchy_paths: [
"window.LavaServerParent",
"window.LavaServerChild"
],
parent_class_data: null,
prototype_generator: function(cd,p) {
var r=cd.references,
s=cd.shared;
p.Class = cd;
p.method = r[1];
p.counter = 0;
p.LavaServerParent$method = r[0];
},
shared: {},
references: [function () { this.LavaServerParent$method(); }],
constructor: function() {}
});
var ServerInstance = new LavaServerChild();
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Native child class creation |
| ready |
Lava child class creation (client generated class) |
| ready |
Lava child class creation (server-side generated class) |
| ready |
Native method call in child class |
| ready |
Lava method call in child class (client generated class) |
| ready |
Lava method call in child class (server generated class) |
| ready |
Lava method call (2) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.