Unusual Performance behaviour of local variables

Certified Lead Developer

Hi,

I observed an unusual behaviour with the performance of local variables used within a!localVariables(). I have a variable local!a and the value to it is mapped from a query entitiy data. I have a second variable local!b and value to it is mapped as local!a (local!b : local!a). And here comes the third variable local!c which has mapped with a query entity data as it's value.

The issue here is the variable local!b takes the same load time as local!a though I am just mapping local!a to local!b (local!b : local!a) and does not have any other operations mapped to local!b. The point to be noted here is when I remove the third variable local!c which is mapped with a query entity as well, then I don't see the local!b takes the same load time as local!a. From this I am understanding that when an interface have more than one query entity then we see this kind of performance behaviour with local variable mapping (local!b : local!a). I may be wrong here with my understanding and if any of you aware of this behaviour, what is the solution recommended please?

Below is the example snippet:

a!localVariables(
local!a: a!refreshVariable(
value: a!queryEntity(
entity: cons!ABC_ENTITY,
query: a!query(
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: - 1
)
)
).data,
refreshOnReferencedVarChange: false()
),
local!b: a!refreshVariable(
value: local!a,
refreshOnReferencedVarChange: false()
),
local!c: a!refreshVariable(
value: a!queryEntity(
entity: cons!XYZ_ENTITY,
query: a!query(
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: - 1
)
)
).data,
refreshOnReferencedVarChange: false()
),
a!textField(
label: "TEST"
)
)

Thanks

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    If the times in milliseconds are always identical (i.e. "822" and "822"), then I think you should assume that this is a quirk in the way the execution times are calculated, rather than evidence that both variables are doing their own run of the query when being assigned values.

    Also, just in general: code is a lot more readable when you use the "Insert --> Insert Code" functionality and paste into a code box - this retains indentation (to spare our eyes) as well as prevents long code from blowing out the size of the post.

  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    Thanks for your response. But when I remove the second query entity on interface(Mapped to local!c), then the local!b never takes load time more than 1ms. So  I am wondering why is it behaving unusual when an interface have more than one query entity mapped to local variables. Also, Though both execution times are identical, I can notice that it accounts to total performance of an interface. 

  • 0
    Certified Lead Developer
    in reply to santhoshs
    when I remove the second query entity

    I'm not sure what's happening on the Appian-side, but I was factoring this into my guess that this is some quirk/bug in the calculation of the load time.  It might be a legit Appian bug.  We'll see what they say about it whenever they see this post.