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
Test different access method to an object property. Just the setters.
<script>
var funct = {
get: function() {
return this._x
},
set: function(value) {
this._x = value
}
}
var es5 = {
_x: 0
}
Object.defineProperty(es5, "x", {
get: funct['get'],
set: funct['set']
});
function es5ctor() {
this._x = 0;
}
es5ctor.prototype = {};
Object.defineProperty(es5ctor.prototype, "x", {
get: funct['get'],
set: funct['set']
});
es5constructed = new es5ctor();
var es5ish = {_x:0}
es5ish.__defineGetter__('x', funct['get']);
es5ish.__defineSetter__('x', funct['set']);
var es3 = {
_x : 0,
getX: funct.get,
setX: funct.set
}
var obj = {x:0};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Object.defineProperty |
| ready |
__defineGetter__ |
| ready |
Normal |
| ready |
es3 |
| ready |
Object.defineProperty on the prototype |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.