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
Compare proxies to direct access, getter/setter functions, and properties.
var testDirect = { x: 0 };
var testGetter = () => testDirect.x;
var testSetter = (x) => testDirect.x = x;
var testProperty = {};
var testPropertyX = 0;
Object.defineProperty(testProperty, "x", { get: () => testPropertyX, set: (x) => testPropertyX = x });
var testProxy = new Proxy({ x: 0 }, {
get(target, prop, receiver) {
return prop === "x" ? target.x : undefined;
},
set(target, prop, value, receiver) {
if (prop === "x") {
target.x = value;
return true;
} else {
return false;
}
}
});Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Direct | | ready |
| Getter/Setter | | ready |
| Property | | ready |
| Proxy | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.