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
<script>
var Ctor = function() {};
Ctor.prototype.variable = 'test';
Ctor.prototype.method = function() {
return this.variable;
};
var Create = {
variable: 'test',
method: function() {
return this.variable;
}
};
var Literal = function() {
return {
variable: 'test',
method: function() {
return this.variable;
}
};
};
(function() {
var variable = 'test';
window.Factory = function() {
return {
variable: variable,
method: function() {
return this.variable;
}
};
};
}());
var HomebrewCreate = function(p) {
function f() {}
f.prototype = p;
return new f();
}
var Ctor2 = function() {};
Ctor2.prototype = {
variable: 'test',
method: function() {
return this.variable;
}
};
var Ctor3 = function() {};
Ctor3.prototype = Ctor.prototype;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
new |
| ready |
create |
| ready |
factory |
| ready |
literal |
| ready |
homebrew create |
| ready |
Ctor with re-set .prototype |
| ready |
Ctor with re-linked prototype |
| ready |
Homebrew create based on existing prototype |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.