I would like to let you know that we have just rolled out a small change to our evaluation engine, which we believe could lead to significant performance benefits to some apps.
When Bubble evaluates an expression in general, any modifier will evaluate its own properties (the fields that you see in the property editor’ slidable panel) and its argument (the right side of the operation, if there is one) before it evaluates the result of the operator.
For something like “A and B”, Bubble used to evaluate A and B regardless of the outcome.
Since the outcome can sometimes be determined just from evaluating A (if A is false, then regardless of B, “A and B” will be false) and in order to match this very common programming optimization, we have implemented the following shorthands:
A and B, but A is false → return false and do not evaluate B.
A or B, but A is true → return true, and do not evaluate B.
This should help speed up things such as conditional properties which depend on two conditions, the first being much lighter to compute than the latter. For example, “Only when Page width < 700px and Do a search for Things:count > 100” will not even attempt to do the search if the page is too wide.
As a small asterisk, this has the potential of being a small breaking change, which however unlikely, is something we would like to communicate:
- if “A and B” is shorthanded, that means that B does not get evaluated at all. If B had any side-effects (maybe through an external API call) these side-effects won’t be triggered.
This pattern is quite rare, but if you are affected by this change, you should alter your expression such that any side-effects happen on the left-hand-side of the expression.
I hope this helps everyone build more performant apps,