MSBA-251 · Lesson 11 of 12 · 19 min

Performance

▶ Video coming soon A video version of this lesson is on the way.

In the second week of UAT, technicians at Ridgeview complained that Field Tech took "forever" to open. Signe timed it on Arlo's phone: eleven seconds from tapping the icon to seeing the job list. Dispatchers had a smaller complaint about Facilities Hub: the Work Order form felt sluggish, especially on old office computers. Nobody would abandon the apps over a few seconds, but people would quietly go back to the spreadsheet if the old way felt faster. AB-410 groups performance with accessibility, responsiveness and usability in one design objective; this lesson covers how to measure and improve it.

Measure first

Performance work starts with measurement, not guesses. Monitor (lesson 10) shows every data request with its duration and size, and which formulas run when a screen loads. Microsoft also provides performance insights for apps in the maker portal and guidance on creating performant apps. Signe recorded a Monitor session of Field Tech starting on Arlo's phone and counted 41 data requests before the first screen appeared.

Baseline measurements for Field Tech.
MeasureToolField Tech beforeTarget
Time to first usable screenStopwatch and Monitor11 secondsUnder 4 seconds
Data requests at start-upMonitor41Under 10
Largest single requestMonitorAssets, 2,600 rows, all columnsOnly needed rows and columns
Delegation warningsApp checker30

Start-up: OnStart versus named formulas

The commonest cause of slow canvas app start-up is a long App.OnStart formula that loads data and sets many variables before the first screen can appear. Everything in OnStart runs in sequence, every time, whether the user needs it or not. Field Tech's OnStart loaded every asset, every location, every part and the technician's record into collections. Microsoft's current guidance is to move such work out of OnStart: use named formulas in App.Formulas, which are evaluated only when needed and recalculate automatically, use App.StartScreen to choose the first screen instead of navigating in OnStart, and load data for a screen when that screen needs it.

Replacing a heavy OnStart with named formulas and a start screen. Data is queried where each screen needs it.
// Before: App.OnStart
ClearCollect(colAssets, Assets);
ClearCollect(colLocations, Locations);
ClearCollect(colParts, Parts);
Set(varTech, LookUp(Technicians, 'Primary Email' = User().Email));
Navigate(scrMyJobs)

// After: App.Formulas
CurrentTech = LookUp(Technicians, 'Primary Email' = User().Email);
MyCampus = CurrentTech.Campus;

// After: App.StartScreen
scrMyJobs

With that change, the job list appeared as soon as its own query returned. The asset list was queried only when a technician opened the Scan asset screen, and then only for the scanned tag.

Ask the data source to do the work

Canvas apps are fastest when the data source filters, sorts and limits rows. That means writing delegable formulas (lesson 3) and asking only for what the screen needs. A gallery showing 12 jobs should not download 6,000. A lookup of one asset by its tag should use LookUp on the tag column, which Dataverse can answer with one small query, rather than loading every asset into a collection and searching it on the phone.

Asking for fewer columns matters too. Dataverse tables can have many columns; Power Apps tries to retrieve only the columns a screen uses, but some patterns, such as collecting a whole table into a collection, retrieve everything. The ShowColumns function can limit columns explicitly when building collections.

Common performance patterns in canvas apps.
PatternSlow versionFaster version
Find one rowCollect the whole table, then LookUp in the collectionLookUp directly on the data source with a delegable condition
Show a filtered listFilter with a non-delegable functionFilter with delegable comparisons on indexed columns
Reference dataReload in every screen's OnVisibleNamed formula or one cached collection with ShowColumns
Several independent queriesRun one after anotherRun together with Concurrent
Related values in a galleryA LookUp per gallery rowUse the relationship (dot notation) or a view that includes the column

Concurrent and caching

When a screen genuinely needs several independent sets of data, the Concurrent function runs formulas at the same time instead of one after another. If three queries take a second each, sequentially they take three seconds; concurrently they take about one. Caching small reference data in a collection, or in a named formula, avoids requesting the same data repeatedly. The offline profile in lesson 8 is itself a cache: on the device, Field Tech reads from local data, which is fast.

Loading three independent sets of data at the same time with Concurrent. Column names are examples.
// OnVisible of the Job Details screen
Concurrent(
    Set(varAsset, LookUp(Assets, Asset = galJobs.Selected.Asset.Asset)),
    ClearCollect(colHistory,
        FirstN(Sort(Filter('Work Orders', Asset.Asset = galJobs.Selected.Asset.Asset),
            'Completed On', SortOrder.Descending), 5)),
    ClearCollect(colPartsUsed, Filter('Parts Used', 'Work Order'.'Work Order' = galJobs.Selected.'Work Order'))
)

Fewer controls, lighter screens

Every control on a screen costs time to render, and galleries multiply that cost by the number of rows shown. Practical rules help. Keep the number of controls in a gallery template small. Avoid complex formulas in gallery items that run for every row. Use containers rather than many overlapping shapes. Compress images and avoid embedding large media in the app. Split very large apps into several smaller ones with a clear purpose. Signe reduced the job card in Field Tech from 14 controls to 7 by combining the location, building and room into one label.

A bar chart comparing before and after for three measures: start-up time fell from 11 to 3.2 seconds, data requests at start-up fell from 41 to 6, and controls per job card fell from 14 to 7.
Field Tech performance before and after the changes.

Model-driven app performance

Model-driven apps are rendered by the platform, so performance work focuses on what the maker configures. Forms with many tabs, subgrids, quick view forms and web resources load more slowly; the first tab should hold only what users need first, because components on other tabs can load when the tab opens. Views with many columns or with columns from related tables take longer to query. Client-side scripts, business rules and plug-ins add work on load and save. Microsoft's solution checker flags some of these patterns.

Signe made three changes to Facilities Hub. She moved the Timeline and a subgrid of related jobs from the first tab to the second, so they loaded only when opened. She removed four rarely used columns from the Open Work Orders view. And she replaced a quick view form that showed six asset columns with two columns from the asset shown directly through the relationship. The dispatchers noticed the difference on the old office computers the next day.

Performance practices for model-driven apps.
Model-driven areaPerformance practice
FormsKeep the first tab light; place heavy components on later tabs
Subgrids and quick viewsUse only where needed; limit rows shown
ViewsShow only needed columns; avoid unnecessary related-table columns
Business logicPrefer server-side and declarative logic; keep client scripts minimal
SearchChoose find columns in the quick find view carefully; use Dataverse search where enabled

Data design and performance

Some performance problems start in the data model. Filtering on a column that is not indexed, or on a calculated value, can be slow at scale. Very wide tables with many columns make every retrieval heavier. Long chains of lookups to show one value add queries. Rollup columns and formula columns are convenient, but their recalculation behaviour should be understood. The Dataverse companion course covers modelling; for builders, the lesson is to raise performance concerns early, when the model is still easy to change.

Networks and devices

Field technicians use phones on mobile networks; dispatchers use wired office computers. A screen that loads in a second in the office may take five on weak mobile signal, because each data request pays the network's delay. Fewer, smaller requests matter more on mobile than on the desktop. That was one reason the offline profile helped Field Tech so much: after the morning synchronization, most screens read local data and did not touch the network at all.

Worked problem

Estimating the benefit of Concurrent

The Job Details screen runs three independent queries. On mobile signal they take 1.4, 0.9 and 1.1 seconds. How long does the screen wait for data if they run one after another, and roughly how long with Concurrent?

Show solution
  1. Sequentially, the times add: 1.4 + 0.9 + 1.1 = 3.4 seconds.
  2. Concurrently, the screen waits for the slowest query: about 1.4 seconds.
  3. The saving is about 2 seconds every time a technician opens a job.

Answer: About 3.4 seconds sequentially and about 1.4 seconds with Concurrent.

Keep performance in the definition of done

Performance degrades as apps grow and data accumulates. Signe added performance checks to the test plan: start-up under four seconds on a mid-range phone over mobile data, form load under three seconds on the oldest office computer, and no delegation warnings. Every release would be timed against those targets before going to production.

Reading a Monitor trace for performance

Monitor is as useful for performance as for bugs. Each network row shows how long a request took and how much data it returned. Sorting by duration shows the slowest requests; sorting by size shows the heaviest. A screen that makes the same request several times usually has a formula in a property that recalculates more often than expected, such as a LookUp inside a gallery template. Signe found exactly that on the My Jobs screen: each of the 12 job cards looked up its location separately, making 12 extra requests. Showing the location through the work order's relationship, which Power Apps retrieves with the job, removed them.

Reading Monitor for performance problems.
Monitor symptomLikely causeFix
Same request repeated per gallery rowLookUp inside the gallery templateUse the relationship or include the column in the query
One very large responseCollecting a whole table or all columnsFilter rows and use ShowColumns
Many requests before the first screenHeavy App.OnStartNamed formulas, App.StartScreen, load per screen
Requests run one after anotherIndependent queries in sequenceConcurrent

Performance of AI calls

Prompts and AI models take noticeably longer than ordinary data requests, often a few seconds. That affects design. A prompt should run when the user asks for it, for example by pressing Suggest, not on every change of a text box. While it runs, the app should show a spinner and keep the screen usable. Where a result is not needed immediately, running the prompt in a flow or a prompt column after the record is saved keeps the user interface fast. Signe measured the triage prompt at about two to three seconds from the app, which was acceptable behind a button but would have been irritating if it had run automatically as the dispatcher typed.

Signe added a final habit: whenever a screen was changed, she reran a short Monitor session before and after the change and compared the number of requests and the total time. It took two minutes and caught one regression in the following month, when a new column on the job card brought back a lookup per row.

Performance budgets

A performance budget is a limit agreed in advance: for example, no screen in Field Tech may make more than five data requests when it opens, and no image added to the app may exceed 200 kilobytes. Budgets turn performance from an occasional clean-up into a design rule. When Maribeth later wanted to add a weather panel to the Job Details screen, the budget prompted the right question before she built it: was the information worth another request on every job opened? She added it as an optional panel that loaded only when tapped.

Budgets also help with the inevitable pressure to add one more column or one more chart to a dashboard. Each addition is small; together they can double load times. Keeping a short list of agreed limits, and checking them in the test plan, protects the experience people were promised.

Flows and server-side work

Some performance problems are best solved by moving work off the device. If a screen calculates totals over hundreds of rows, a formula or rollup column in Dataverse can compute them on the server, and the app simply reads one value. If saving a job triggers several updates to related rows, a cloud flow or plug-in can do them after the save instead of the app waiting for each one. Field Tech originally updated the asset's Last Serviced date from the app after completing a job; moving that update to a flow triggered by the completed work order removed a second save from the technician's wait and made the rule apply however the job was completed.

Common mistakes

  • MistakeLoading every table into collections in App.OnStart.

    InsteadUse named formulas, App.StartScreen and load data where each screen needs it.

  • MistakeGuessing at the cause of slowness.

    InsteadMeasure with Monitor and the App checker, then change one thing at a time.

  • MistakePutting the Timeline and many subgrids on the first tab of a form.

    InsteadKeep the first tab light so the form opens quickly.

  • MistakeRunning independent queries one after another.

    InsteadUse Concurrent for independent queries.

After the changes, Field Tech opened in just over three seconds on Arlo's phone over mobile data, and under two in the workshop on Wi-Fi. The complaints stopped. Nobody said thank you, which Signe took as the best possible feedback.

Summary and key terms

  • Measure performance first with Monitor, the App checker and timings on real devices and networks.
  • Move heavy work out of App.OnStart into named formulas and App.StartScreen, and load data where it is needed.
  • Use delegable queries, retrieve only needed rows and columns, cache small reference data and run independent queries with Concurrent.
  • Keep screens and gallery templates light; in model-driven apps keep the first form tab light and views lean.
  • Include performance targets in testing so each release is checked.
App.OnStart
A canvas app property whose formula runs when the app starts, before the first screen.
App.StartScreen
A canvas app property that chooses the first screen declaratively.
Concurrent
A Power Fx function that evaluates several formulas at the same time.
ShowColumns
A Power Fx function that returns a table with only the specified columns.
Performance insights
Guidance and measurements Microsoft provides to help makers find and fix app performance problems.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Why is a long App.OnStart a performance problem?

    Show answer

    It runs in sequence every time before the first screen appears, loading data the user may not need.

  2. Three independent queries take 1, 2 and 1.5 seconds. Roughly how long does Concurrent take?

    Show answer

    About 2 seconds, the time of the slowest query.

  3. Name one way to make a model-driven form open faster.

    Show answer

    Keep the first tab light by moving heavy components such as the Timeline and subgrids to later tabs.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz