cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Improve App Performance

Hi, 

 

I have been working on this app for around 2 months now and is going to the finishing stage. I notice the app is pretty slow when loading on start up and load data between screens (especially when I'm using screen dependencies. Ex: Gallery.Selected). Majority of the suggestions from app checker are to use variables or collections. I tried searching for a tutorial on how to do that but the post PowerApp Optimization Technique is with SQL while my app is using SharePoint List. Also, I saw some post suggested to use ClearCollect and Concurrent but I'm having trouble with the coding. Can you please give me some suggestions on which one will work better with my app? 

 

Thank you, 

Nhi 

9 REPLIES 9
GarethPrisk
Resident Rockstar
Resident Rockstar

ClearCollect simply combines the functions Clear() and Collect() together, to simplify coding when you want to clear the collection and then repopulate it. No performance gain here.

 

Concurrent will allow you to execute multiple requests/functions in parallel. Some source systems, like CDS or SharePoint, will work well in this scenario. So instead of collecting 5 lists in order, you can concurrently collect all 5 - and the function ends when the slowest branch is completed. NOTE: This may impact the order of operations, so plan accordingly.

 

Global variables are slower than local variables, but have the advantage of being accessible on all screens. Local variables will remain set for a given screen, but have to be set/updated on the screen itself.

 

Check out the Monitor functionality as well, when testing your app. It will identify any heavy calls you have, and allow you to potentially reduce the number of calls, or the size of the call itself.

eka24
Super User
Super User

Kindly watch these two videos if you haven't already. Performance tips from Shane and Paul. Issues includes clearcollect, delayed loading, Using lookup in Galleries etc
https://youtu.be/BnolkTK2Sng
https://youtu.be/foJqD09Enfk

If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution
Anonymous
Not applicable

Hi @GarethPrisk ,

 

I'm guessing you are suggesting to use either Concurrent or maybe a local variable. With concurrent, from what I learned is you need to use a collection which I tried to import my datasource into a collection but no luck --> Collect(Collection1,'IE Report'). My datasource is approx. 1000 rows so it exceed the 500 limit. Also, the Collect option only works with a button (under onselect formula)? It suggested to use filter to limit data collection but I'm having trouble coding that. 

Anonymous
Not applicable

Hi @eka24 , 

 

Thanks for the suggestion. I watched both of these videos but it doesn't have any tips regarding the problem that I am having right now. My main issue with delay loading is due to screen dependency which both of them didn't mention that in their video. 

 

A few things to note, regarding 'App Performance.'

Do you mean?

  1. The app performs slowly in the Studio (editing)
  2. The app performs slowly when running the app in a browser
  3. The app performs slowly when running the app on the PowerApps mobile app
  4. In all scenarios, the app is slow because the data loads 'slowly' or there are visual delays in the UX?

The reason I ask is that we will want to determine if we need to fix 'subjective' or 'objective' performance issues. In some instances, the app is going to be limited by the connectivity (i.e. on good WiFi, or bad cell service, etc.). In those cases, you can load the data into the app using Collections, and then app will run faster since the operations are against the local collection. If/when you need to refresh the data, or write changes back, the connectivity factor still comes back into play.

 

As far as the Collect function. This is a function and can be invoked any way that a function can be invoked - not just On Select (here is a list of most (if not all) of the common behavior triggers...the OnX's).

 

Concurrent will allow you to run multiple function branches at once. This is most advantageous when loading data into collections.

 

In regards to Collecting data. You are correct that they are limited to 500 records by default. You can change this number under advanced app settings, from 1-2000. NOTE: This may work for your example of ~1000 records, but is not necessarily a long-term fix. If your table exceeds 2000 records, then you will want to consider switching back to a direct connection, or filtering/paging the data to get it into the collection within the delegation limit.

PowerAppSettings_DelegationLimit.png

 

Let me know about what 'app performance' means to you, and we can troubleshoot/tweak based on your needs.

Anonymous
Not applicable

@GarethPrisk , 

 

So my app is running slowly in a browser and I am under the company's wifi so internet won't be an issue. I can see it is running slowly due to me using (Gallery.Selected) throughout the app and the buffering dots still showing even though all of my data loads. As a quick fix, I refreshed the app and it was able to fix the issue right there but isn't for long term use. I use (Gallery.Selected) across 1-2 screens for different edit forms so I just want to find a way to cut the data loading time down. 

 

I tried to load my data into a collection but since it is ~1000 records, it suggested me to either using lookup or filter. Could you show me a sample code that I can try to test it out? For my app, I have the user search for a code in a gallery, which then the information for that code is populated into a form on the next screen; hence I used (Gallery.Selected)

For the Gallery.Selected stuff, you can pass that along as either a Context variable, or set a Global variable with the value (if passing the variable becomes too cumbersome).

 

Let's say you have Screen1, with Gallery1, and Screen2 with Gallery2.

  • Determine what click makes the user navigate to Screen2
  • That click (such as OnSelect of an icon), have a function like
    • Navigate(Screen2, ScreenTransition.Fade, {locGallery1Selected: ThisItem})
  • This will pass a context variable to Screen2 called locGallery1Selected
    • This variable is the row/record you just clicked in Gallery1/Screen1
  • Use this reference on Screen2
    • To Filter Gallery2
      • Filter(Source,{SourceField} = locGallery1Selected.{MatchingField})
    • The Item for a Form
      • Property Item = locGallery1Selected
      • This assumes the Form is for the same data source

 

The alternative would be to use a global variable.

  • That click (such as OnSelect of an icon), have a function like
    • Navigate(Screen2, ScreenTransition.Fade); Set(gblGallery1Selected, ThisItem)
  • Use this reference on Screen2
    • To Filter Gallery2
      • Filter(Source,{SourceField} = gblGallery1Selected.{MatchingField})
    • The Item for a Form
      • Property Item = gblGallery1Selected
      • This assumes the Form is for the same data source

 

 

Some other questions:

  1. Can you describe all of your data sources (not details of the data itself, but what is the source system (like SharePoint), and how many records per source)?
  2. How often should the data in the app be refreshed? How often are you creating/updating data back the source systems?
Anonymous
Not applicable

So the way that I set my app up is a little complicated since I used so many datasource (sharepoint list) for different forms. 

 

I don't really pass the results from 1 gallery to another gallery but from gallery to a form. 

 

So (screen 1) is home page and upon selection of a button ---> (screen 2) gallery to search for code ----> screen 3 (click to the corresponding department) ----> (screen 4) based on the selection, the needed info from that datasource is populated into the form (I'm guessing this is causing the delay of data load since it is not directly data transfer from screen 1 to 2 but from screen 1 to 3). All of these steps are linked to Datasource A which is ~1000 records. The results of this submitted form is going to a separate datasource (Datasource B), which builds up over time. My app is not technically updating any datasource but rather taking fields from one datasource and use that as an "ID" to save the submitted form in another datasource if that makes any sense. Datasource B would only be used if another department wants to check the results of that particular code. 

yuxi666
Microsoft
Microsoft

Hi @Anonymous 

 

>Can you please give me some suggestions on which one will work better with my app? 

Please reference this: performance-tips 

 

Best Regards.

yuxi

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,965)