1---2name: winapp-performance3description: Investigate slow WinUI 3 layout, scrolling and virtualization using native ETW captures, timed operation trees and managed GC suspension context. Use bounded queries for runtime performance questions, not crash analysis or UI correctness.4metadata:5 source: https://skillmd.com/skills/microsoft/winapp-performance6---78## Workflow9101. Read the [WinUI performance guide](https://github.com/microsoft/WinAppCli/blob/main/docs/guides/winui-performance.md)11 for capture limits, query options, partial-result handling, privacy and interpretation.122. Use the existing app PID when possible. Start with13 `winapp perf start --app <pid> --output <empty-directory> --json`.14 `--app` also accepts a process name or window title using the same matching15 rules as `winapp ui`. Use the returned `target.pid` for subsequent UI actions.16 For a new launch, use `winapp run <project> --profile <empty-directory> --detach --json`.17 This records after launch, which is enough for navigation, scrolling and other18 post-launch scenarios. For startup investigations only, add `--profile-mode elevated`19 (one UAC prompt for the recorder, which the user must approve) and check20 `Profile.StartupCoverage`; see the guide's21 [startup workflow](https://github.com/microsoft/WinAppCli/blob/main/docs/guides/winui-performance.md#record-startup-layout).22 Do not add startup delays or replace a generated `Main`.233. Wait for successful recording readiness. Save the returned capture ID.244. Mark the beginning with `winapp perf mark <id> --name scenario-start --json`,25 drive a short repeatable scenario with verified UI selectors, wait for its26 visible outcome, then run `winapp perf mark <id> --name scenario-end --json`.275. Run `winapp perf stop <id> --json` before closing the app.286. Start with29 `winapp perf analyze <directory> --from-marker scenario-start --to-marker scenario-end --json`30 to compare mutually exclusive primary-UI-thread activity, the hottest parsed31 XAML resources, and the detailed operation ranking. Use `--view parsing` over32 the same range when the parsing preview needs full paging. Then query33 `winapp perf analyze <directory> --view hotspots --from-marker scenario-start34 --to-marker scenario-end --json`; its default threshold is 16.67 ms and each35 row includes dominant direct child operations. Expand a36 returned operation with `--view call --id <call-id> --depth 2 --from-marker37 scenario-start --to-marker scenario-end --json`. Use `--view calls --family38 layout` with the same marker range when the hotspot evidence points to layout.39 Query `--view gc --sort duration` over the same marker range to find the longest40 collection and suspension intervals, then inspect referenced interval IDs. Use41 element and event views for source and evidence drill-down. Follow `nextOffset`;42 do not dump NDJSON or ETL into context.43 For overall resource cost, use `--view resources` over the same marker range;44 see the guide's45 [process counters](https://github.com/microsoft/WinAppCli/blob/main/docs/guides/winui-performance.md#compare-process-resource-cost).46 For app-side composition, query `--view calls --family composition` and47 `--view events --event DCompDeviceCommit` over the same marker range; see48 [composition submission](https://github.com/microsoft/WinAppCli/blob/main/docs/guides/winui-performance.md#separate-xaml-work-from-composition-submission).49 For Microsoft.UI.Reactor apps, the summary has a `Reactor` category; query50 `--view components` over the same marker range to rank components by exclusive51 time with render counts and reasons, and expect slow render passes in `hotspots`52 with the component that requested them; see53 [Reactor components](https://github.com/microsoft/WinAppCli/blob/main/docs/guides/winui-performance.md#find-expensive-reactor-components).547. Report observed cost, supporting event IDs, coverage gaps, and one concrete next55 experiment. Preserve stdout when partial results accompany a nonzero exit code.5657## Guardrails5859- Use `--profile-mode elevated` only for startup, and tell the user to expect a UAC60 prompt. If they decline it, do not retry; fall back to the default attach mode and61 say that early startup may be missing. Otherwise never elevate, change tracing ACLs,62 or modify app code to make capture work.63- Recording is local only. Do not combine `run --profile` with `--on sandbox`;64 see the guide for the supported launch and recording commands.65- Readiness is not decoded coverage. Missing events are inconclusive.66- For WinUI operations, use elapsed-time terminology; do not claim CPU/GPU attribution, displayed FPS,67 proven input-to-display latency, or complete startup/visual-tree coverage.68- `Unclassified` includes idle, waits, and uninstrumented work. Do not describe it69 as app code or CPU use. Off-thread image decode is not UI-thread occupancy.70- A Reactor app with no `Reactor` category is using a Reactor version without71 perf spans; that is missing evidence, not zero Reactor cost.72- Reactor `created at` call sites appear only when source mapping is on73 (`REACTOR_SOURCEMAP=1`). It adds cost, so don't compare timings between74 recordings with and without it.75- Process CPU counters include all target threads but do not attribute functions,76 modules, or waits. Sampled memory/thread maxima can miss brief spikes; missing77 samples are not zero resource use.78- Trace-local element IDs are not UI Automation selectors.79- Composition calls are elapsed API scopes, not GPU work or display latency.80 DComp device commits are notifications, not timed or displayed frames; check81 `directCompositionProvider` before interpreting missing events.82- Call trees are instrumented operation scopes, not CPU stacks or visual trees.83 Keep exclusive scope time distinct from element self time.84- GC is requested by default but may be unavailable. Check `gcCoverage` separately;85 missing events are not zero pauses. Background GC duration is not suspension time,86 and overlapping runtime suspension is not proof that GC blocked the native UI.87- Keep raw captures local unless the user has reviewed and authorized sharing them.88- Use the UI automation skill to interact with the app and troubleshooting/debug89 output workflows for crashes; neither replaces performance evidence.