Optimizing the performance of Canvas Apps

| Ijlal Monawwar

In my experience of developing PowerApps, there are several ways to optimize the performance of a Canvas App, including:

Delegation: Delegation allows our app to take advantage of the capabilities of the data source, such as filtering, sorting, and grouping, rather than performing these operations locally within the app. Here is an example of using the Filter function to delegate a filter operation to the data source:

Filter(Customer, Name = "Lionel Messi")

Limit Data Connections: Limiting data connections will reduce the number of transactions performed between the data sources as each connection requires a lot of CPU resources, memory and network bandwidth. Limiting them to under 30 connections is ideal.

Caching data: Caching data allows your app to store frequently used data locally, reducing the number of round trips to the data source and improving the performance of your app. You can use the Set and Get functions to implement data caching in your app. Here is an example of how to cache data in a Canvas App. We can use collections to store and process data locally instead of retrieving data from the data source each time.

// Set the cache

Set(MyCache, Filter(Customer, Name = "Lionel Messi"))

// Get the cache

MyCache

Using Concurrent function: In a Canvas App, the Concurrent function allows you to run multiple asynchronous functions in parallel, rather than running them sequentially. This can be useful when you want to perform multiple tasks concurrently to improve the performance of your app.

Here is an example of how to use the Concurrent function in a Canvas App:

Concurrent(

UpdateContext({myVar1: "Task 1"}),

UpdateContext({myVar2: "Task 2"}),

UpdateContext({myVar3: "Task 3"})

)

In this example, the Concurrent function is used to run three tasks in parallel: updating the value of myVar1, myVar2, and myVar3. These tasks will be run concurrently, rather than sequentially, improving the performance of the app. We can also set up the concurrent function on the OnStart property of the app, to load data simultaneously.

Concurrent(

ClearCollect( ProductNames, '[ProductTable].[Name]' ),

ClearCollect( CustomerNames, '[CustomerTable].[Name]' ),

)

It's important to note that the Concurrent function does not return any values, so it is not suitable for use in expressions that require a return value. Instead, it is used to perform multiple tasks concurrently.

Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.


M
Chief Architect, Founder, and CEO - a Microsoft recognized Power Platform solution architect.

About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting