{"ScriptPreparationCode":"const obj = { x:1, y:2, z:3 };\r\nconst native = { _x:1, _y:2, _z:3, get x() { return this._x; }, set x(v) { this._x = v \u002B 10; },\r\n get y() { return this._y; }, set y(v) { this._y = v \u002B 10; },\r\n get z() { return this._z; }, set z(v) { this._z = v \u002B 10; } }\r\n\r\nconst proxyFactory = (obj) =\u003E new Proxy(structuredClone(obj), {\r\n set(target, prop, value) {\r\n if (!Object.hasOwn(target, prop)) {\r\n throw new Error();\r\n }\r\n\r\n target[prop] = value \u002B 10;\r\n return true;\r\n },\r\n });\r\n\r\nconst gsFactory = (obj) =\u003E {\r\n const gs = { __internal: structuredClone(obj) };\r\n for(let k in gs.__internal) {\r\n Object.defineProperty(gs, k, {\r\n get() {\r\n return this.__internal[k];\r\n },\r\n set(value) {\r\n this.__internal[k] = value \u002B 10;\r\n }\r\n })\r\n }\r\n return gs;\r\n}\r\n\r\nfunction Factory() {\r\n this.__internal = structuredClone(obj);\r\n}\r\n\r\nfor(let k in obj) {\r\n Object.defineProperty(Factory.prototype, k,{\r\n get() {\r\n return this.__internal[k];\r\n },\r\n set(value) {\r\n this.__internal[k] = value \u002B 10;\r\n }\r\n })\r\n}\r\n\r\nconst protoFactory = () =\u003E new Factory();\r\n\r\nconst run = (sut, times = 1000) =\u003E {\r\n let i = times;\r\n let y = 0;\r\n while (i--) {\r\n sut.x = i \u002B 2\r\n sut.y = i \u002B 1\r\n sut.z = i\r\n y \u002B= sut.x \u002B sut.y \u002B sut.z\r\n }\r\n return y;\r\n}\r\n\r\n\r\nconst runMany = (f, obj) =\u003E {\r\n const sut = f(obj);\r\n let i = 1000;\r\n let y = 0;\r\n while (i--) {\r\n y \u002B= run(sut, 10)\r\n }\r\n return y;\r\n}\r\n\r\nwindow.proxyFactory = proxyFactory;\r\nwindow.gsFactory = gsFactory;\r\nwindow.protoFactory = protoFactory;\r\nwindow.run = run;\r\nwindow.runMany = runMany;\r\nwindow.native = native;\r\nwindow.obj = obj;\r\nwindow.proxy = proxyFactory(obj);\r\nwindow.gs = gsFactory(obj);\r\nwindow.proto = protoFactory();","TestCases":[{"Name":"proxy","Code":"return run(proxy);","IsDeferred":false},{"Name":"getter/setter","Code":"return run(gs);","IsDeferred":false},{"Name":"prototype getter/setter","Code":"return run(proto);","IsDeferred":false},{"Name":"native","Code":"return run(native);","IsDeferred":false},{"Name":"many proxy","Code":"return runMany(proxyFactory, obj);","IsDeferred":false},{"Name":"many getter/setter","Code":"return runMany(gsFactory, obj);","IsDeferred":false},{"Name":"many prototype getter/setter","Code":"return runMany(protoFactory, obj);","IsDeferred":false}]}