User bio
404 bio not found
Member since Jul 25, 2017
Posts:
Replies:

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=$zhfor i=1:1:1E6 { if##class(%DynamicArray).%New()  } set t1=$zh-t1
	while$zh#1 {} set t2=$zhfor i=1:1:1E6 { if##class(%DynamicObject).%New() } set t2=$zh-t2
	while$zh#1 {} set t3=$zhfor i=1:1:1E6 { if [] } set t3=$zh-t3
	while$zh#1 {} set t4=$zhfor 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.6650.40165.90%
DynObject :    0.6490.40161.87%

Maybe someone else or the WRC has an explanation...

JavaScript uses underscores as separators in (big)number literals.

<script>alert(1_234);</script> displays 1234
<script>alert(12_345_678_901_234_567_890_123n);</script>  displays 12345678901234567890123

Maybe there is a quirk/problem in VS terminal...

Certifications & Credly badges:
Julius has no Certifications & Credly badges yet.
Followers:
Julius has no followers yet.
Following:
Julius has not followed anybody yet.