Skip to content

Commit d9521ca

Browse files
committed
RenderSpeed test
1 parent e3c6897 commit d9521ca

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

MDX2JSON/Tests.cls.xml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ Moves widgets datasources into Mobile folder</Description>
108108
do ##class(MDX2JSON.Tests).DynamicObjects()</Description>
109109
<ClassMethod>1</ClassMethod>
110110
<Implementation><![CDATA[
111-
112111
set obj = $$$NewDynObj
113112
set obj.prop = "val"
114113
$$$DynObjToJSON(obj)
@@ -120,12 +119,35 @@ do ##class(MDX2JSON.Tests).DynamicObjects()</Description>
120119
]]></Implementation>
121120
</Method>
122121

123-
<Method name="RenderMDXToJSONString">
122+
<Method name="RenderSpeed">
124123
<Description>
125-
do ##class(MDX2JSON.Tests).RenderMDXToJSONString()</Description>
124+
do ##class(MDX2JSON.Tests).RenderSpeed()</Description>
126125
<ClassMethod>1</ClassMethod>
127-
<FormalSpec>MDX:%String</FormalSpec>
128-
<ReturnType>%String</ReturnType>
126+
<FormalSpec>MDX:%String,Count:%Integer(MINVAL=1)=10</FormalSpec>
127+
<Implementation><![CDATA[
128+
Set:$d(MDX)'=1 MDX = "SELECT NON EMPTY [Product].[P1].[Product Category].Members ON 0,NON EMPTY [Outlet].[H1].[Region].Members ON 1 FROM [HoleFoods]"
129+
Set RS = ##class(MDX2JSON.Utils).GetResultSet(MDX,.st)
130+
Write $System.Status.GetErrorText(st)
131+
Set obj = RS.ToProxyObject(.st)
132+
Write $System.Status.GetErrorText(st)
133+
Set od=$io
134+
Set nul=##class(%Device).GetNullDevice() //"\\.\nul" // /dev/null/ - UNIX
135+
Open nul
136+
Use nul
137+
138+
Set startTime = $NOW()
139+
For i = 1:1:Count {
140+
$$$DynObjToJSON(obj)
141+
}
142+
Set endTime = $NOW()
143+
144+
Set time = $p(endTime,",",*) - $p(startTime,",",*)
145+
Use od
146+
Close nul
147+
Write "Iterations: ",Count,!
148+
Write "Time Total ",time,!
149+
Write "Time Average: ",time/Count
150+
]]></Implementation>
129151
</Method>
130152
</Class>
131153
</Export>

0 commit comments

Comments
 (0)