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 : PA2HHA0EN9RaVWicE0ZvLv
Power Automate - General Discussion
Unanswered

Very simple Do Until loop taking around 0.2 sec per loop

Like (0) ShareShare
ReportReport
Posted on 10 Aug 2020 21:46:01 by 127

I have created a very simple flow with a very simple Do Until loop, and is taking around 0.2 sec per loop, what I consider too much.

 

Is normal this duration, when the only thing done in the loop is increase the loop control variable (tmpcounter in the example).

 

See blow sample flow and sample ran time.

 

SimpleDoUntilLoop.PNG

 

SimpleDoUntilLoop-ran.PNG

 

Thanks, Victor.

I have the same question (0)
  • manuelstgomes Profile Picture
    6,625 on 11 Aug 2020 at 09:32:37
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    Hi @vllanso 

     

    You have the option of parallelizing the operation. It may speed-up your processing.

     

    To enable it:

    Screenshot_2020-08-11_at_10_30_12.pngScreenshot 2020-08-11 at 10.30.03.png

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

  • vllanso Profile Picture
    127 on 11 Aug 2020 at 09:50:46
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    Manuel, thanks for your answer, but I have tried and it looks like the Do-Until settings doesn't include the parallel option.

     

    I see in your sample screen that the "Apply to each" control does have the parallel option ... but the Do-Until doesn't, at least for me it doesn't show.

     

    Any other option you can think of to speed the loop execution time ?

     

    Thanks.

  • manuelstgomes Profile Picture
    6,625 on 11 Aug 2020 at 10:02:38
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    Hi @vllanso 

     

    Indeed, sorry, I read it as Apply to each instead of "Do Until."

     

    To be honest, I never recommend a "Do Until" for pretty much anything. You never know when it will end, and it may trigger issues like the ones you have. The Power Automate should always be the trigger, process, and end. The only exceptions are the Approval actions where they hold until a defined timeout until the Power Automate ends, but you always know when it ends. Makes sense?

     

    Can you please explain a little bit further so that we can try to remove it and use another component that ends in a deterministic way?

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

  • vllanso Profile Picture
    127 on 11 Aug 2020 at 11:35:17
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    Hello,

     

    Here is a high level description of what I am trying to accomplish:

    * I have a string variable of 50 characters

    * I want to loop through each character in sequence, and depending on each value, translate it to a new char (based on an internal translation table)

     

    This process is supposed to be triggered by a user from a PowerApp, so the response time should be "quick".

     

    But as explained at the beginning of this thread, a very simple loop without any calculation already takes around 10 seconds, so that is not "acceptable" from the user point of view.

    I have also done a test changing the "Do-Until" with an "Apply to Each" control, but the time to loop through a very simple "Apply to Each" is also "high" and equivalent to a "Do-Until".

     

    Thanks.

  • manuelstgomes Profile Picture
    6,625 on 11 Aug 2020 at 11:57:51
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    HI @vllanso 

     

    Indeed this is too slow for a user UI.

     

    The only way I can see to speed up is to do an "Apply to each" with a parallel option.

     

    How are you doing the transformation? Probably we can try to optimize there.

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

  • vllanso Profile Picture
    127 on 11 Aug 2020 at 16:38:48
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    Hello,

     

    I have replace the Do-Until with 2 consecutive "Select" controls and now the execution time is around 1 sec for the complete process.

     

    I was 'inspired' by the following solution/thread: https://powerusers.microsoft.com/t5/Building-Flows/Split-string-into-array-of-characters-empty-delimiter-not/td-p/189153

     

    - in the first "Select" control I convert my 50 character string to a 50 items array

    - in the second "Select" control,  I use as input the outpot from the first "Select", and configure the "Map" function of the form: if( equals( item(), 'a' ), 'x' ), if( equals( item(), 'b' ), 'y', .......

    - finally I join all the items from the second "Select" output in a new 50 character string

     

    and as mentioned, the combined time is around 1 sec.

     

    Thanks for all your help and suggestions.

  • manuelstgomes Profile Picture
    6,625 on 12 Aug 2020 at 10:31:53
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    Hi @vllanso 

     

    The combined time is already with the parallel option enabled?

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

  • vllanso Profile Picture
    127 on 12 Aug 2020 at 11:11:27
    Re: Very simple Do Until loop taking around 0.2 sec per loop

    Hello Manuel,

     

    as far as I know, the "Select" action does not have the option to enable parallel execution, so to answer your question, the aprox. 1 sec run time is without parallel execution, not in the "Select" action, neither in any other actions of my flow.

     

    So it looks like in some circumstances, "Select" is a plausible alternative for "Do-Until" or to "Apply to each".

     

    Thanks, Victor.

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…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 707 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 499 Moderator

#3
chiaraalina Profile Picture

chiaraalina 312

Last 30 days Overall leaderboard
Loading complete