User bio
404 bio not found
Member since Apr 14, 2022
Replies:

I would venture to assume that this difference is due to the overhead of calling the class method. In other words:

  • ##class(%DynamicArray).%New() -> ..%OnNew() -> $ZU()
  • [] -> $ZU()
There was a similar topic: Shared code execution speed
"Real life" *.inc entry is to execute macro routine "Entry^HS.Local.VA.Util.Log(%arr,,"D")" if Global ^GlFSL("Debug") is >0 by calling from a classmethod as $$$TestIf(arr) - no return value is required.
#define TestIf(%arr) if (^GlFSL("Debug")>0) {do Entry^HS.Local.VA.Util.Log(%arr,,"D")};or#define TestIf(%arr) do:^GlFSL("Debug")>0 Entry^HS.Local.VA.Util.Log(%arr,,"D")
Usage:
$$$TestIf(5)
Statement "set a = $$$TestIf(3)" is included into a classmethod with no other code in. Expected output 5
What is the expected result for the next operator?
set $$$TestIf(-3)
Certifications & Credly badges:
Vitaliy has no Certifications & Credly badges yet.
Followers:
Vitaliy has no followers yet.
Following:
Vitaliy has not followed anybody yet.