User bio
404 bio not found
Member since Jul 25, 2017
Posts:
Replies:
I can't reproduce the problem
Well, I'm neither part of the ObjectScript nor the Objects developer team, hence I can't answer the "why" part of your question but fact is, timing mesuremenst show a significat higher speeds for the literal versions:
ClassMethod DynObject()
{
while $zh#1 {} set t1=$zh for i=1:1:1E6 { if ##class(%DynamicArray).%New() } set t1=$zh-t1
while $zh#1 {} set t2=$zh for i=1:1:1E6 { if ##class(%DynamicObject).%New() } set t2=$zh-t2
while $zh#1 {} set t3=$zh for i=1:1:1E6 { if [] } set t3=$zh-t3
while $zh#1 {} set t4=$zh for i=1:1:1E6 { if {} } set t4=$zh-t4
write "Times for : Class Literal Diff",!
write "DynArray :", $j(t1,9,3), $j(t3,9,3), $j(t1/t3-1*100,9,2),"%",!
write "DynObject :", $j(t2,9,3), $j(t4,9,3), $j(t2/t4-1*100,9,2),"%",!
}
The output will depend on
- IRIS/Cache version in use and
- on the underlying hardware
My values are
USER>d ##class(DC.Times).DynObject()
Times for : Class Literal Diff
DynArray : 0.665 0.401 65.90%
DynObject : 0.649 0.401 61.87%
Maybe someone else or the WRC has an explanation...
Certifications & Credly badges:
Julius has no Certifications & Credly badges yet.
Global Masters badges:







Followers:
Following:
Julius has not followed anybody yet.
At least, there are four different ways to get that info
ClassMethod StudioTest() { write "Call from Studio1: ",..InStudio1(),! write "Call from Studio2: ",..InStudio2(),! } /// Is the invocation from the Studio? ClassMethod InStudio1() { for i=$st:-1:1 if $st(i,"PLACE")["%Studio.General." ret 1 ret 0 } /// Is there a connection to Superserver? ClassMethod InStudio2() { set port=1972 // see iris.cpf, section [Startup], DefaultPort=... quit $p($v(-1,$j),"^",3)[("|TCP|"_port_"|") }Compiling routine DC.Util.1 Compilation finished successfully in 0.024s. do ##class(DC.Util).StudioTest() Call from Studio1: 1 Call from Studio2: 1 ICINDY:USER>; from PuTTY ------------------- ICINDY:USER>do ##class(DC.Util).StudioTest() Call from Studio1: 0 Call from Studio2: 0The other two methods are: checking for the presence of
a) a dedicated variable or
b) a dedicated object
but both require a usage of undocumented functions