Conditional Workflows/Actions and Performance

I have several workflows in my app that have conditional actions. All else being equal, is it better from a performance perspective to have multiple workflows, each of which will only be run under certain conditions, or to have one workflow with many conditionally run actions?

For simple workflows, I have not noticed a difference but am currently in the process of trying to speed up some of my slower workflows and would like to know if this would be a fruitful route to pursue.

Thanks!

Iā€™ve found that itā€™s usually best done on the Event level (Button A is clicked and only whenā€¦) if the conditions donā€™t rely on the actions themselves like a User A/B Type action

If you do it on the action level and just having a singular Event, the workflow runs through every action every time even if most of them donā€™t meet the criteria. Instead if you have it on the Event level, you pre-determine which set of actions will be ran

2 Likes

Thanks @peng.o that makes a lot of sense, especially because some of my work flows require a search in the conditional, I realize now I was probably running that search multiple times which was a huge drag on performance, Iā€™ll probably start moving all that out to the workflow level.

1 Like

I agree with @peng.o.

Additionally, weā€™ve found thereā€™s only 1 drawback with this approach - sometimes it takes a while for the first action to be triggered (because Bubble is checking which workflows to run first).

When thatā€™s important to address, weā€™ve found a more advanced solution that solves for this without sacrificing performance. The approach is to have a single workflow run when the user clicks the button (no conditions on the workflow), then include a set of ā€œCustom Eventsā€ that are conditionally triggered within that workflow. As such, you could also include actions that always run before or after these custom events (e.g., for example, update a custom state to make the button text a font-awesome loading icon).

Just FYI for anyone coming across this wants that immediate feedback to the user that the button has been clicked and the app is processing their request.

8 Likes

Thatā€™s a very intriguing idea. Iā€™ll have to keep that in mind for the future. I have not played around much with the custom events yet except for the ā€˜on input value changeā€™ so that is definitely an area of bubble I should start exploring.

Thanks for the help!