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;
}
};
function shared() { }
shared.prototype = sharedPrototype;
function intermediate() { }
function crockfordCreate(o) {
intermediate.prototype = o;
return new intermediate();
};
function Constructor() { }
Constructor.prototype = new shared();
Constructor.prototype.one = function() { return 1; };
Constructor.prototype.two = function() { return 2; };
Constructor.prototype.three = function() { return 3; };
</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.