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
Wondering how much of a difference hoisting f out of crockfordCreate will make.
<script>
var sharedPrototype = {
one: function() {
return 1;
},
two: function() {
return 2;
},
three: function() {
return 3;
}
};
var crockfordCreate = function(o) {
function F() {}
F.prototype = o;
return new F();
};
var Constructor = function() {
this.one = function() {
return 1;
};
this.two = function() {
return 2;
};
this.three = function() {
return 3;
}
return this;
};
Constructor.prototype = sharedPrototype;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Object.create() |
| ready |
Crockford Create |
| ready |
Constructor |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.