web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Flow - Apply to each - very slow

(2) ShareShare
ReportReport
Posted on by 2,914

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.

I have the same question (0)
  • v-yuazh-msft Profile Picture
    on at
    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

  • PaulD1 Profile Picture
    2,914 on at
    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard