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
<script>
obj = { _x: 0, _y: 0, _z: 0 };
var acc = 0;
obj.__defineGetter__('x', function() { return this._x; });
obj.__defineSetter__('x', function(v) { this._x = v; });
Object.defineProperty(obj, "y", {
configurable: true,
get: function() { return this._y; },
set: function(v) { this._y = v; }
})
obj.setX = function(value) {
this._x = value;
}
obj.prototype = {
get z() {
return this._z;
},
set z(value) {
this._z = value;
}
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
__defineGetter__ |
| ready |
Object.defineProperty |
| ready |
Normal |
| ready |
Prototype |
| ready |
Setter |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.