Skip to content

Investigate and implement spec 023: Performance Insight Tools #25

Closed

Description

Track investigation and implementation of spec 023.

Spec: docs/specs/023-perf-insight-tools.md

Problem (short)

A WinUI/XAML developer asking "why is my app slow?" has powerful but disjoint tools (VS Diagnostic Tools, PerfView, WPR+WPA, the 24H2 WPA XAML Frame Analysis plugin, GPUView, EnableFrameRateCounter, Live Visual Tree). None of them speak the developer's language: they report threads, stacks, GC generations, DX queues, and DWM frames, while developers think in XAML elements, bindings, templates, and components. Bridging that gap is left entirely to the human, so most teams ship something that feels slow and depend on one expert who can read an ETL.

Design-time cost is invisible until runtime; runtime cost is unattributable back to design. ETW already gives us a shared clock across kernel/user/native/managed — what is missing is a coherent schema, correlation, and framework-aware attribution on top of it, plus a surface an AI agent can query without parsing .etl files.

High-level options to explore

  1. Convention layer over ETW (spec's core bet). A universal interval primitive (System.Diagnostics.Signpost, §9.1), a universal correlation field (IntentId, §7.2), compile-time stable element identity (PerfTag, §9.2), and a compile-time perf report from the XAML compiler (PerfReport.json, §9.3). Bulk of value ships in WinUI / XAML compiler / .NET BCL; Reactor contributes a narrow set of component-layer extensions (§10).
  2. Attribution mechanism (§11) — pick one or blend.
    • A. AsyncLocal<IntentId> — cheap, managed-only, breaks at native/threadpool boundaries.
    • B. Correlation Vector field on events — crosses managed/native/process boundaries; requires framework cooperation.
    • C. Out-of-band sampling + post-hoc attribution — zero framework changes, lossy for short work.
    • Spec recommendation: ship A for v1, migrate to B as WinUI formalizes the schema, use C opportunistically.
  3. Design-time estimator. v1 lookup table keyed on element-kind × effect-count × repeater-size, seeded by a synthetic workload catalog (§12). v2 real-device telemetry, MetricKit-style (§12.3).
  4. Agent-first surface. xamlperf CLI with canonical JSON trace export (§13.1/§13.2) plus optional MCP server (§13.3). Designed for agent consumption from day one, not retrofit.
  5. Responsibility split (§8). Decide which capabilities belong in microsoft/microsoft-ui-xaml, the XAML compiler, the .NET BCL, vs. Reactor. Default is "WinUI-native unless it provably cannot live there."

Next steps (per spec §17, Phase 0 — 2 weeks)

  • Decide attribution mechanism A/B/C via prototype.
  • Prototype Signpost API (§9.1) and PerfTag synthesis (§9.2) in user-space.
  • Fix or replace the EnableFrameRateCounter AV on WinUI 3 Desktop.
  • Inventory Microsoft.UI.Xaml.Controls.Perf events; coordinate with WinUI team on formalizing a subset.
  • Working minimal overlay against StressPerf grid.

Activity

  1. added
    design proposal
    and removed
    design proposal
    on May 4, 2026
  2. azchohfi commented on Nov 16, 2026

    @azchohfi
    Collaborator

    Most of what Reactor owns in this spec has shipped, just not under the names the spec uses.

    Spec 023 is mostly a WinUI spec. The Reactor part is §10, and the core of it landed in #1485 and #1491, both in preview.18. Reactor now writes a Microsoft-UI-Reactor-Perf ETW provider that a non-elevated private session can record. That fixes the elevation problem that sank the spec 032 overlay (#507). It has a span for each render pass and each component render, with why the component rendered, which component requested the pass, the reconcile edit counts, and the C# call site when source mapping is on.

    winapp perf reads it. microsoft/winappCli#837 added recording and analysis and microsoft/winappCli#1300 added the Reactor views. winapp perf analyze <dir> --view components ranks components by exclusive time with render counts and reasons, and --view hotspots lists slow Reactor passes next to slow frames. Every view has --json and winapp ships an agent skill for it, which covers the agent-first goal in §13. #1300 is on winapp main and should go out in the next winapp release.

    Where §10 stands

    Item Status
    Component as a unit of cost Done. ComponentRender spans carry id, name, reason and call site
    Rollups up the component tree Done. winapp shows inclusive and exclusive time per component
    Re-render count per component Done, with the reason for each render
    Render() as its own cost boundary Done
    Memoization hit rate Partial. Only the aggregate skipped count per reconcile
    Re-renders that produce identical output Not done
    PERF005, too many SetState calls per render Not done

    The rest of the spec (Signpost, PerfTag in the XAML compiler, PerfReport.json, the XAML analyzers, the DebugSettings overlay, the dependency graph API, the design-time estimator, MCP and trace compare) is owned by WinUI, the XAML compiler, .NET or winapp per the spec's own §8. None of it is actionable in this repo.

    Closing this as done for the Reactor part. The two gaps left in §10 are tracked in #1538.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions