cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Flow - Apply to each - very slow

I have a Flow with a string variable (not super long, maybe a few hundred words).

 

The flow iterates (Apply to each) through a list of substitutions (just a two column list of 'string_to_find' and 'string_to_replace_with').

 

On each iteration, a Compose action perfroms a Replace function, taking the string variable and substituting any instance of 'string_to_find' with 'string_to_replace'. A Set Variable action then stores the updated string from the Compose step back into the variable and the loop goes round again.

 

The substitution table has 12 entries (so the apply to each runs 12 times).

 

The 'Apply to each' loop routinely taking more than 5 seconds to complete. Given that this is a simple set of string substitutions, I'm surprised at how slow this is.

 

Unfortunately I now need to create another Flow using similar a technique but with more looping required and currently this one is taking over 20 seconds using just a small amount of test data.

 

Is there some way I can speed this up? How much 'processing power' does Flow give? In my experience, Flow is very quick at transferring data (pushing/pulling to/from various services/sources) but any 'internal' processing (such as this example of string substitution) seems very slow.

2 REPLIES 2
Community Support Team
Community Support Team

Re: Flow - Apply to each - very slow

Hi @PaulD1,

 

Could you please share a screenshot of the configuration of your flow?

 

I suggest that you could run the flow in a good browser condition and there is no any other way to speed up the flow run.

 

Best regards,

Alice

Super User
Super User

Re: Flow - Apply to each - very slow

Hi Alice (@v-yuazh-msft)

 

Below are images of relevant part of the Flow and the time taken to run. You will see that it is doing a simple text substitution on each loop using a Replace function and saving the result back to a variable.

 

The loop consists of 12 rows of data, each with two columns (Element and Replacement) the idea is to add some HTML formatting codes to a block of HTML code. Two example rows are shown below:

 

  {
    "Element": "<table>",
    "Replacement": "<table style=\"font-size:14px; border-collapse: collapse; width: 100%;font-family: Verdana,Serif; \">"
  },
  {
    "Element": "<thead>",
    "Replacement": "<thead Style =\"text-align: left; color: black; font-family: Verdana,Serif;background-color: #B5C3CB;\">"
  },

For a simple set of text substitutions, 6 seconds seems excessive to me. As per OP I have some more complex scenarios where more loops are required and performance is becoming a problem.

 

I don't see how browser condition is relevant as all this runs server side.

 

Thanks

Paul

 

Flow Slow Loop 1.pngFlow Slow Loop 2.png

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 303 members 4,804 guests
Please welcome our newest community members: