Power Apps Performance Optimization Guidelines

Power Apps Performance Optimization Guidelines
Subscribe
Notify of
guest

39 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Piotr Rusak
Piotr Rusak
3 years ago

Hi Matthew – great article (as always). I spotted 1 mistake – in last example – in Lookup(Accounts … should be Lookup(colAccounts… (just to really avoid N+1 calls ;-))
Thank you for your contribution to the community – Matthew You Rock !!

Gil Shalem
Gil Shalem
3 years ago

Hi Matthew, and thanks for the great content!
About the very last code snippet:

// Join tables to get account name
ClearCollect(
colGalleryData,
AddColumns(
colContacts,
“AccountName”,
LookUp(Accounts, ID=ThisItem.AccountID, ‘Account Name’)
)
);
If we already captured the Account table into a collection, why do we need to lookup the account name in the Account DataSource? Wouldn’t it be better to now look it up in the colAccounts collection? meaning:
LookUp(colAccounts, ID=ThisItem.AccountID, ‘Account Name’)

Thanks,
Gil.

Haylee
Haylee
3 years ago

I just want to send a huge THANK YOU for all of these helpful guides you create and share with the community!

Voltron
Voltron
3 years ago
Reply to  Haylee

Присоединяюсь!

Voltron
Voltron
3 years ago

in Russian I join means that I share, I support. applies to this comment with gratitude. your blog is one of the most helpful. Thanks

Last edited 3 years ago by Voltron
Jay
Jay
3 years ago

Hi Matthew, thanks for the very informative article.

May i just if you collect, you will just get the first 2000 records from the SharePoint, right? And also, is it okay to put my OnStart code to the OnVisible property of my first screen? I also have navigate function on my OnStart code.

Many thanks, Mate!

Jay
Jay
3 years ago

Hi Matt,
I have deep linking function and I just included it on my OnVisible property.

Larry
Larry
3 years ago

Hi Matt,
Thanks for developing this helpful website. I wanted to ask you and community how they’d design an app that has over 100K records and growing. With 2K delegation limitations, I’ve tried the collection approach and kept only the required columns/fields but it can still take up to 4-5 minutes to load all of the data. How would you improve on the loading time or is there other better approaches?

Larry
Larry
3 years ago

To ensure that all of the data are there and to prevent delegation warnings that omit a bulk of the data, I found that using this approach retrieves the correct data. Even filtering a subset of the data, it runs into delegation warnings because there are so many records. I know there is probably a better approach. I’m open to ideas to try.

beyondthebox
beyondthebox
2 years ago
Reply to  Larry

Power Apps makes no secret of their data row limitations. If you are insistent that you have to bring in 100,000 rows…this is not the product for your use case.

BTW, I believe that 2000 rows it just too low and that this is a Microsoft centric limitation. Regardless, I have actually found few reasons that much data is needed in an app. Larry, your provided explanation does not really tell us why you need that much data at one time.

Eric Kaplan
3 years ago

Matthew, Great content. You are an inspiration to this long time Excel User learning Power Apps. I have followed everything here except I have some Dataverse Choice columns to patch. I have used the following to patch all the changes at once. Doesn’t Patch the three choice columns I have. Does work for the text input column. Can’t quite get the syntax here. Thanks, Eric

If(
  CountRows(colUpdates)>0,
  Patch(
    TaxDatas,
    colUpdates
    );

Parwej Pathan
Parwej Pathan
3 years ago

Thanks Mathew! I read the statement “Each control in a gallery only counts as 1 control no matter how many times it is shown.” But I couldn’t find that in MS documentation. Recently , I was debating over Gallery control with 50 columns and 200 records with a colleague. Would really like to hear your opinion.

I really feel MS shall give # of control recommendation for Phone, tablet, desktop app separately.

beyondthebox
beyondthebox
2 years ago
Reply to  Parwej Pathan

I would disagree with this conclusion. Each control uses memory and each control in a gallery consumes memory based on the number of rows in the gallery. Also, the control limits in Power Apps are just a warning. There is not hard set rule. I have a business app with two screens. Once has 467 controls, the other 375 controls. Not all the controls are visible at any give time. The trick is to write the code efficiently and isolate the screens fully. My app runs very fast.

Alex
Alex
2 years ago

Hi Matthew, I am reading this article and found a typo in the “Cache Data in Collections and Variables” section: A cloud datasrouce must receive a connector call, perform a query and send a response back to the device before data can be displayed on-screen.

Thank you for your articles, it’s GOLD!

Mark Oram
Mark Oram
2 years ago

Hi, great article but I have a problem with an app that is connected to 110 sharepoint lists, the one to interact with is selected via a drop down on the first screen. It works fine for the general user however when trying to edit it takes over an hour tom open and even then I can’t change anything, saying an ongoing refresh operation is preventing it. I think the answer is to use an automated flow to create a collection using get items but I don’t want to slow the app for the general user, especially when it comes to writing changes back to the list. Is this viable?

Niklas Aldén
Niklas Aldén
1 year ago

I agree that 110 SharePoint lists are way to much but the documentation you mention talks about connecting to 30 different datasources, not 30 instances of the same connection.

30 connectors, so connecting to 30 different services using different connectors, woudl be a nightmare to load becuase you have to log in 30 times. Fetching 30 SharePoint lists only requires one login since it’s only connecting to one service.

Andrew
Andrew
2 years ago

“Each control in a gallery only counts as 1 control no matter how many times it is shown.”

I’m guessing you mean under the hood? When I use a gallery to replace repeated controls, I actually get a higher estimated complexity number (at least +1 for the gallery, sometimes more) even though it may also be performing better.

Niklas Aldén
Niklas Aldén
1 year ago
Reply to  Andrew

One control takes x amount of memory. If you create two separate controls that looks the same, it will still count as 2x amount of memory. But when you put a control in a gallery, it doesnt matter if it is shown in a thousand rows, it will still only be one instance and take x amount of memory.

Tim
Tim
2 years ago

Hello Matthew,
Sweet as always, i was wondering how i can :
your way:

ClearCollect( colUpdateEmployees, Table( {ID: 2, FullName: “Alice Henderson”, Active: true}, {ID: 4, FullName: “David Wright”, Active: false}, {ID: 5, FullName: “Mary Allen”, Active: false} ) )

my way:
If(!IsBlank(LookUp(colPickUp1;ID = ThisItem.ID));Remove(colPickUp1; LookUp(colPickUp1; ID=ThisItem.ID));
  Collect(colPickUp1;ThisItem)
)

how can i use Collect(colPickUp1;ThisItem) to add hassent = 1 into the colpickup1
Like in your top code?

because i normally use patch in a slow way it seems
ForAll(
     colPickUp1;
     Patch(
           OnlineData;ThisRecord;
      {
        HasSent: 1
      }
     ))

I like to use the faster patch 😉
But no idea how i can add hassent in my collect(colpickup1, thisitem)

Thank you.

Peter
Peter
1 year ago

Hi Matthew, great article and really appreciate all the information you have provided.
I’m running into an issue that’s driving me crazy. I need to do a lookup inside a clearcollect call, and cannot get it to work. I copied your example from the N+1 problem, and am getting an error on the “thisitem” portion that says “name isn’t valid.ThisItem is not recognized”.
Any help would be tremendously appreciated

Powerapps.png
Eric Alexandre
Eric Alexandre
1 year ago

hi Matthew, I enjoyed your article but I don’t understand the very last snippet. For me ‘ThisItem’ it not needed. Besides it creates an error. It should be:

ClearCollect(
colGalleryData,
AddColumns(
colContacts,
“AccountName”,
LookUp(colAccounts, ID=AccountID, ‘Account Name’)
)
);

PowerApps user
PowerApps user
1 year ago

In my PowerApps application, I have implemented transition screens using a single background image. To create the transition effect, I am using multiple transition images on the Screen. However, I have noticed that it takes a considerable amount of time to load these images when the button is selected, resulting in a delay. 

I would appreciate your guidance on how to address this issue and improve the loading time of the transition images. If there are any alternative solutions in PowerApps that can help optimize this process, please let me know.

Thank you for your assistance.

Best regards,
PowerApps user

Niklas Aldén
Niklas Aldén
1 year ago
Reply to  PowerApps user

There is a setting in Power Apps which makes the app load components only when they are called for. This is great for most apps, since it makes the initial loading time quicker and then just load in items on demand as you go.

But if you want to load in images (that are probably a bit big) and make it feel fluent, you need to have these pre-loaded and should therefore probably turn off the mentioned setting. Do however note that this can affect load time of the app since it now needs to read those images (and everything else) to memory at the same time.

claire
claire
1 year ago

Hi Matthew, any advice or best practices with regards to multiple screens and datasources? Ive got 10 datasources with the same table. Is it better to use
1 screen per datasource OR 1 screen for many datasource since the screen function is the same.
Also

Is it better to use datasource directly or use a collection for better performance?

Nicole
Nicole
1 year ago
Reply to  claire

Claire – this is my question, too…Matthew: is it better to use the data source directly or use a collection for better performance? And aside from performance, I am worried about reaching request limits by directly referencing the SharePoint each time someone views a screen. Maybe that is unreasonable because 40,000 calls in 24 hours SOUNDS like a lot but I’m worried it might add up faster than expected if the user is interacting with lots of different apps in a given day?? (https://learn.microsoft.com/en-us/power-platform/admin/api-request-limits-allocations) That’s why I am not using Formulas in my apps yet – it might be faster but it causes more requests to SharePoint!

Niklas Aldén
Niklas Aldén
1 year ago
Reply to  Nicole

Kind of depends on what kind of processing you will do with the data once it’s in the app. Collections should almost be seen as read-only as they are only a copy of the actual data.

If you need multiple sources combined in a table, a collection is probably the way to go. But on the other hand, if the amount of data is huge, a collection will quickly eat up the devices memory and the app will be sluggish.

So, it is very hard to answer this question without more detail since it really depends.

Jayaprakash Murugan
1 year ago

Question: Significant Load Time Difference Between Android and iOS Devices in PowerApps
Hi everyone,
I’m experiencing a significant difference in load times between Android and iOS devices when using a PowerApps app. On iOS, the app loads within 8 to 15 seconds, whereas on Android, it takes around 1 minute and 30 seconds to load.
Here are some details:

  • Data Source: I’m using Dataverse.
  • OnStart: The OnStart event is clean—I’m not using any collections or heavy logic here.
  • Monitoring: I’ve used the Monitor tool, but it hasn’t provided any useful insights related to this issue.

Has anyone else encountered a similar problem, or does anyone have suggestions on what might be causing this discrepancy? Any help or guidance would be greatly appreciated!
Thanks in advance!

Cameron Finch
Cameron Finch
9 months ago

Something that has been plaguing me has been the performance cost of components, and I’ve finally found an amazing solution when you need a nice looking read-only component.

“HTML text”

This only counts as a single component, and lets you create some very complex layouts. I’m starting to use this in list galleries and the performance when scrolling is boosted significantly. If I need the user to select an item from the list, I just place a button component over the top.

The “HTML text” component doesn’t directly support blocks or “class”, but you can create a your own using the With() function and placing those variables inside the “style” attribute of each element.

You can use with externally hosted files, but not local media like “SampleImage”. The same goes for , you can only render svg files with and using a url for the “src”.

Hyperlinks work with with the same limitations of Launch()

Example:
With(
{
cssTable: $”
width: 100%;
max-width: {Max(600, Parent.Width * 0.8)}px;
margin-left: auto;
margin-right: auto;
padding: 0;
border-collapse: collapse;”,

cssGroupHeaderRow: ”
border-bottom: 1px solid #96D4D4;”,

cssGroupHeaderCell: $”
padding-top: 12px;
padding-left: 6px;
padding-right: 6px;
padding-bottom: 6px;”,

cssGroupHeaderH4: ”
margin: 0;”,

cssFieldHeaderCell: $”
width: 152px;
padding-top: 4px;
padding-left: 12px;
padding-bottom: 4px;
font-weight: 200;
font-style: italic;
border-bottom: 1px solid #edf8f8;
vertical-align: top;”,

cssFieldDataCell: ”
padding: 4px;
vertical-align: top;
border-bottom: 1px solid #edf8f8;”,

cssImgProfilePic: ”
max-width: 24px;
max-height: 24px;
vertical-align: middle;
margin-right: 5px;
border-radius: 20px;

},
$”

Heading A

Component width
{Self.Width}

Component height
{Self.Height}

Active screen
{App.ActiveScreen.Name}

Heading B

Current user

{User().FullName}

Email
{User().Email}


)