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.
*** IF CURRENT PAGE IS BROKEN - then visit repository for the link to proper version. ***
<script src="http://kogarashisan.github.io/PerfTests/export/dependencies-v2.js"></script>
<script src="http://kogarashisan.github.io/PerfTests/export/bundle-v2.js"></script>
<script>
/*
Each model exports two children into window, for example:
TypeScriptChildA and TypeScriptChildB
This code creates 5 instances of each child for each model
and stores them in global model_instances array.
Model test then can be done as follows:
var instances = model_instances[0]; // TypeScript
// just a large loop
for (var i = 0; i < 100000; i++) {
// call `method` on each of 10 different instances
for (var c = 0; c < 10; c++) {
instances[c].method();
}
}
*/
var model_names = [
/* 0 */'TypeScript',
/* 1 */'CMBrowserMono', // ClassManager
/* 2 */'CMBrowserPoly', // ClassManager
/* 3 */'CMServerFullrefMono', // ClassManager
/* 4 */'CMServerPartialrefMono', // ClassManager
/* 5 */'CMServerPartialrefPoly', // ClassManager
/* 6 */'DNW_IW_', // DotNetWise inheritWith
/* 7 */'DNW_FC_', // DotNetWise fastClass
/* 8 */'Fiber',
/* 9 */'JR', // John Resig
/* 10 */'NativeUnwrapped',
/* 11 */'NativeWrapped',
/* 12 */'Klass', // klass
/* 13 */'AugmentClassical' // augment
];
var model_instances = [];
for (var model_index = 0; model_index < model_names.length; model_index++) {
var constructorA = window[model_names[model_index] + 'ChildA'];
var constructorB = window[model_names[model_index] + 'ChildB'];
model_instances[model_index] = [
new constructorA("a1"),
new constructorB("b1"),
new constructorA("a2"),
new constructorB("b2"),
new constructorA("a3"),
new constructorB("b3"),
new constructorA("a4"),
new constructorB("b4"),
new constructorA("a5"),
new constructorB("b5")
];
// warm-up loop
for (var dummy = 0; dummy < 5; dummy++) {
for (var c = 0; c < 10; c++) {
model_instances[model_index][c].method();
}
}
}
</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 (unwrapped) |
| ready |
Native (wrapped) |
| ready |
klass |
| ready |
augment |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.