Setting a variable with a conditional: calculation faster than script steps

Discussion created by johnnyb on Apr 30, 2015
Latest reply on May 1, 2015 by siplus

Setting a variable conditionally using the calculation engine is faster than using script step conditionals, according to my tests.


In other words,


Set Variable [ $variableName ; If ( condition ; trueValue ; falseValue ) ]


is faster than


If [ condition ]

Set Variable [ $variableName ; trueValue ]


Set Variable [ $variableName ; falseValue ]

End If


The difference varies, but in the script shown in the attachment, the advantage is about 33%.


I wasn't sure whether this would be the case based on what I could discern from the documentation and other forum threads.


I suppose this means there is a noticeable tradeoff between step-by-step visibility and conditional evaluation performance in this case.