Hello, Today I want to explain how to improve performance of yours Canvas App. Any comments, integrations or suggestions are welcome 🙂
Cache local data
Does your data chanche during session of your app? If you reply “No”, you should store your data into local variable and get record from it, instead always ask to database.
ClearCollect(CollProject,Projects_1)
PS: Keep mind delegation problem.
ClearCollect Function more informations here.
You should also cache for user data. Example, if you you email of connected user:
User().Email
Consider:
Set(UserEmail,User().Email)
Optimize OnStart Event – Concurrent
If you create and load collection on “OnStart” event (or on visibile), consider use of Concurrent Function. People tipically write this:
ClearCollect(CollProject,Projects_1);
ClearCollect(CollManager,Manager)
In this case, formula loads each tables one at a time. If you want optimize, you should write this:
Concurrent(
ClearCollect(CollProject,Projects_1),
ClearCollect(CollManager,Manager))
Now your app fetches the tables in parallel.
Use delegations
You shouden’t retrieve all data and then filter locally. Delegate data processing to data source (If is possible). See connectors documentation to learn about delegable formula.
For SharePoint check this link.
For SQL Server:
Use Indexes Column
Simple, but people sometimes forgot to set indexes on column. For SQL Server and SharePoint, check wich columns you’re using to filter, and set Index on these columns.
How to set index on SharePoint columns.
How to set index on SQL Server and Azure SQL.
Replace Defaults() with Variable
When you want to create new record in your table you , tipically you use Default() function. When you use it, there is a call to your datasource …
Defaults(Projects_1)
And Idea is store result of this function on variable, and use it instead call Default() every time:
Set(
newProject,
Defaults(Projects_1)
);
Debug – Monitoring Time
If you want to understand what happens “behind the scenes”, you should start a debugging session. From Power Apps portal, select your app and click Monitor:
Now you can understand durations and respons size of your function to prevent performance issue.
Considerations
Check this official link for other tips .I hope this post was usefull for you.Leave me comment if you has appreciate it.
Contact me for questions! Have a nice day!