Forum Discussion
In our last release, we made a change under the hood where we process OR statements in formulas faster. Consider this formula for instance:
IF(
[SummaryField]>0 OR [My Checkbox field]=true,
"Foo",
"Bar"
)
Before the June release, even if the condition [SummaryField]>0 were true, Quick Base would also evaluate [My Checkbox field]=true. However, if the condition before the OR is true, than the whole OR statement will also be true. So, the optimization we just made was to stop evaluating the condition after an OR operator, if the condition before the OR is true. This means that your formulas which contain OR statements have gotten faster. But the main reason for my post, is you now have a new option for optimizing your formulas. If your formula contains an OR operator, the formula will run faster if you place the condition which will run faster BEFORE the OR operator.
But how can you tell which conditions will run faster?
A condition will take more time if...
-it includes a derived field (formula, lookup, or summary).
-It will take even longer if the derived field has a chain of derived fields behind it (ie � a lookup of a formula field)
-If it�s a summary field, it will take even longer if the child table has a large number of records.
-If it�s a summary field, it will take even longer if the field has additional criteria.
-it includes a Text � Multiple Choice field with a large number of options.
-it includes a Text � Multi-line field where -the records on the table have a lot of data.
-the condition uses the Contains function.
-two fields are being compared.
A condition will take less time if...
-it does not include a derived field.
-it uses the equals operator.
-a field is being compared with a static value.- _anomDiebolt_8 years agoQrew EliteThis is called short circuit evaluation. If you optimize for OR's for an early appearance of a true value you can likewise optimize for AND's for an early appearance of false. But wait, just replace the Formula language with JavaScript and you will get these two specific optimizations for free and a whole lot more.