PowerApps: Improving app performance

There are many reasons that an app can be slow to load, slow to respond, and slow to write to data sources.  If your app feels sluggish there is often a lot you can do yourself to make it more reactive, even though the root of the problem may have to do with the way PowerApps is designed.

It is important to understand the reasons why your app may be slow, before you can address them.  Here are some common causes I have found, please leave a comment if you have identified others.

  • The app has a large number of controls/objects that directly reference on-line data sources for many of their properties.  This slows performance on opening the app since the controls/objects in all screens of the app need to be populated when the app is opened, not just the first screen.  Also, every time you save a change to a data source (for example you add a new record), then performance will also be slow because all the app’s screens will need to be updated for the change.  There is an experimental setting called ‘Delayed load’, but it is not clear that this resolves the issue.
  • Shaping expressions (i.e. Filter or Search) that contain clauses that require frequent server calls, for example:
    • many LookUp() expressions
    • filtering records with the User() function
    • creating new records with the Defaults() function
    • use of ForAll() loops instead of using a set approach.  This is similar to cursors versus set based approaches in SQL
  • Shaping expressions that are not delegated, since PowerApps will first retrieve all the first 500 rows of any data source(s) involved and then do the shaping
  • Use of inherently slow data sources such as Excel on OneDrive

 

Here are some of the things that you can do, links are to other posts where they exist:

  1. Cache any parent table for lookups locally instead of looking up the data source directly
  2. Cache the current user with the User() function once, instead of calling the function throughout the app
  3. Use a set approach instead of ForAll() loops.  This is similar to cursors versus set based approaches in SQL.  I will try to make a separate post on this
  4. Avoid use of concatenated screens/galleries/labels (i.e. searching in a text box changes the items shown in a gallery which in turn changes the item shown in a view form in a separate screen etc. etc.)
  5. Avoid use of slow data sources (e.g. Excel on OneDrive)
  6. Avoid use of non-delegated functions
  7. Avoid use of Defaults(), which makes a server call every time it is used

For 4, I would suggest that instead of using the Selected property in the dependent objects (i.e. galleries, drop downs etc.), that you set a context or a global variable (or alternative save in a collection) and then use this in the subsequent objects.

For 5 and 6, the direction of the solution is obvious, although maybe not easy to implement.

Of course there are also obvious things like internet connection speed and operating system/memory issues, but those are not strictly PowerApps related.

I hope you have found this post interesting and useful.  Any comments or suggestions are welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *