{"ScriptPreparationCode":"// *class* defined in terms of OLOO\r\nvar class1 = {\r\n set_property: function(name, value) {\r\n this.properties[name] = value;\r\n },\r\n get_property: function(name) {\r\n return this.properties[name];\r\n },\r\n \tget_p: function() {\r\n return this.p;\r\n },\r\n \tset_p: function(val) {\r\n this.p = val;\r\n }\r\n}\r\nfunction inst_class1() {\r\n var obj = Object.create(class1)\r\n obj.properties = {}\r\n obj.p = 0;\r\n return obj;\r\n}\r\n\r\n// just an object with it\u0027s own methods\r\nfunction inst_class2() {\r\n\treturn {\r\n \tproperties: {},\r\n \tp: 0,\r\n \tset_property: function(name, value) {\r\n \tthis.properties[name] = value;\r\n \t},\r\n \tget_property: function(name) {\r\n return this.properties[name];\r\n },\r\n get_p: function() {\r\n \t return this.p;\r\n \t\t},\r\n set_p: function(val) {\r\n this.p = val;\r\n }\r\n }\r\n}\r\n\r\n// es6 class\r\nclass class3 {\r\n \tconstructor(props, p) {\r\n this.properties = props;\r\n \tthis.p = p;\r\n }\r\n set_property(name, value) {\r\n this.properties[name] = value;\r\n }\r\n get_property(name) {\r\n return this.properties[name];\r\n }\r\n get_p() {\r\n \treturn this.p;\r\n }\r\n \tset_p(val) {\r\n \tthis.p = val;\r\n }\r\n}\r\n\r\nfunction inst_class3() {\r\n var obj3 = new class3({}, 0);\r\n return obj3\r\n}\r\n\r\n\r\n// the test\r\nfunction test(obj) {\r\n \tvar result = 0;\r\n for (var i = 0; i \u003C N; i\u002B\u002B) {\r\n obj.set_property(i, i*0.33);\r\n result \u002B= obj.get_property(i);\r\n obj.set_p(result);\r\n result \u002B= obj.get_p();\r\n }\r\n \treturn result;\r\n}\r\n\r\n// test direct properties\r\nfunction test1(obj) {\r\n \tvar result = 0;\r\n for (var i = 0; i \u003C N; i\u002B\u002B) {\r\n obj.properties[i] = i*0.33;\r\n result \u002B= obj.properties[i];\r\n obj.p = result;\r\n result \u002B= obj.p;\r\n }\r\n \treturn result;\r\n}\r\n\r\nvar N = 10000;","TestCases":[{"Name":"oloo","Code":"var result = test(inst_class1());","IsDeferred":false},{"Name":"object with own methods(no inheritance)","Code":"var result = test(inst_class2());","IsDeferred":false},{"Name":"classes","Code":"var result = test(inst_class3());","IsDeferred":false},{"Name":"test direct properties","Code":"var result = test1(inst_class2());","IsDeferred":false}]}