Temporary Values
When writing Actions, you can reduce the amount of repeated processing within aggregate values or loops by storing computed values as temporary values.
A loop could be Existence, For all or chaining predicates, as well as While loops or Loop over objects operations.
If a calculation requires a value that will be the same across all objects that it will use, it would be better to add that as a temporary value in an action so that a separate rule isn't needed.
If each iteration of the loop is performing some non-trivial work on the current object such as buffering, then it is quicker to perform the buffering once, assign the result to a temporary value and then use the temporary value within the loop.
Example: A Rule checking the age of Buildings
To find the building ages you may have originally configured a Rule to:
Check that building.ConstructionDate < get_current_date()
This will subsequently call:
get_current_date()
for every building
However, it would be more efficient to replace this with the following Action:
singleton let temp_value_current_date = get_current_date()
Followed by a Rule for Buildings:
check that building.ConstructionDate < temp_value_current_date