Are you flows slow, and did you wish that you could take your flows out of the stone age? Flow performance can be very important.
Why improve Flow performance?
In general there are two reasons to consider to improve the flow performance.
- A user is waiting for your flow to finish
- A lot of work is being done by your flow
Today I’m having a look at handling multiple arrays of data. In my example I will collect all connectors from my UK and Europe environments and I want a new collection of connectors that exist in the UK and also exist in Europe.
Imagine when you migrate your flows from a UK based environment to Europe and you want to make sure that all your connectors used are still available.
The slow flow performance way
At first you might think about creating two apply to each steps and step through all 308 connectors in the UK. For each of these 308 connectors you would go through the connectors in Europe and job done!
You will be waiting for a very long time.
Flow will now be running 308 * 308 times through the same steps.
This flow will take more than 1 hour to run! I didn’t wait for it to complete and cancelled my flow after a while as I didn’t want to waste a lot of time waiting for my flow to complete.
In the above example I’m only comparing two arrays. In my example below I’m gong to have a look at 4 environments in 4 different locations. As I posted before the connectors available in each location does vary.
We will need to speed this flow up! Power Automate can perform better than this.
The intersection function
The intersection function does exactly the same as the above flow. The intersection function takes a number of arrays and will take items that exist in all arrays. I will however need to do a bit more than just run the intersection function.
The List Connector action will add some information in each array item that is specific to each of my environments. Running an intersection on the output form the List Connectors actions will simply result in empty arrays of data as the items in the arrays don’t exactly match.
To create a clean array of data I’m now pushing the List Connectors data through an Select action.
I do the same for each of my environments making my data ready for the intersection function. For more information on the Select actions pleae have a look at Convert your time faster in Power Apps to all time zones using Power Automate.
And now we are down to 0 seconds when we run the flow! This is a massive improvement from over an hour run time.
0 Seconds is good enough for me!
Some thoughts on Flow performance
It is important to massage your data using the select action. Using the select action it is possible to shape the data exactly the way that your flow needs your data. Doing this will then improve the performance of your flow.
When a flow is slow, run your flow and find the pain points, once the pain points are clear the performance improvements will be quite easy.
Related performance posts
In the past I’ve written quite a few more posts about performance in flows. Below a few posts that may help you improve your flow performance.