Skip to content

docs(perf): Add the measured performance evidence - #24238

Merged
MartinZikmund merged 3 commits into
masterfrom
dev/mazi/docs-perf-evidence
Oct 3, 2026
Merged

MartinZikmund merged 3 commits into
masterfrom
dev/mazi/docs-perf-evidence

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: n/a — documentation only

PR Type:

📚 Documentation content changes

What changed? 🚀

Adds specs/059-performance-improvements/evidence.md, the measured evidence behind the performance
series in this batch of PRs. It records:

  • The harnesses — a headless app that project-references the real Uno.UI, Uno.UI.Composition,
    Uno.WinRT, Uno.Foundation and Uno.UI.Dispatching so every measurement runs the code being
    changed; and a dotnet-trace + TraceEvent analyzer that attributes allocations by type and call
    stack
    , which is how each finding was located rather than guessed.
  • One section per fix with its before/after numbers, the control workloads that prove no drift,
    and the runtime-test comparison done as sets of failing test names against a baseline build.
  • A correction. One entry originally reported −64.6 % on time; that comparison was invalid
    (the two runs used different workload sets, so JIT warm-up differed) and the corrected figure is
    −15.3 %. The correction and its cause are recorded rather than quietly edited.
  • What was deliberately not done — the measure-side text-layout cache (audited unsafe: five
    invalidation sources bypass the funnel, one of which is a live bug), the DependencyProperty
    detail pools that are rarely returned, an optimisation that measured well but was reverted for
    diverging from WinUI, and micro-optimisations rejected for having no measurable win.
  • The validation limits — an unfiltered runtime-test run crashes with an access violation in the
    SKSurface finaliser, and the pre-fix tree crashes identically, so validation rests on filtered
    suites of up to 937 tests rather than a whole-suite run.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — n/a, documentation only
  • 📚 Docs have been added/updated
  • 🖼️ Validated PR Screenshots Compare Test Run results. — n/a, no code change
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

Copilot AI lite review requested due to automatic review settings August 27, 2026 07:20
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new internal engineering evidence document capturing measured before/after performance data and validation notes for the ongoing Uno Platform performance-improvement work.

Changes:

  • Adds specs/059-performance-improvements/evidence.md documenting the measurement harnesses, baseline numbers, and per-fix before/after results.
  • Records correctness validation methodology (filtered runtime-test suites, set-comparison of failures) and known validation limitations.
  • Documents investigated-but-rejected optimizations and pre-existing runtime-test failures/crash constraints for future maintainers.
Suppressed comments (2)

specs/059-performance-improvements/evidence.md:74

  • The micro-benchmarks section name includes a machine-specific path. Consider using the same <local-path> placeholder for consistency with the other harness descriptions.
### 2.3 Micro-benchmarks — `D:\Throwaway\uno-perf-bench`

specs/059-performance-improvements/evidence.md:63

  • The allocation-profiler section also hard-codes local D:\Throwaway\ paths. Using the same <local-path> placeholder keeps the instructions copy/pasteable across machines.
### 2.2 Allocation profiler — `D:\Throwaway\uno-perf-analyzer`

`dotnet-trace` + a TraceEvent-based analyzer that attributes sampled allocations **by type and by
call stack**, which is how each finding below was located rather than guessed:


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@unodevops

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund changed the base branch from feature/breakingchanges to master September 2, 2026 20:01
@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund MartinZikmund changed the title docs(perf): Add the measured performance evidence docs(perf): Add the measured performance evidence Sep 10, 2026
Copilot AI review requested due to automatic review settings September 10, 2026 12:50
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/docs-perf-evidence branch from a09ece8 to 5a01289 Compare September 10, 2026 12:50
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 17s —— View job


Review complete ✅

  • Gather context (PR diff, review comments, custom instructions)
  • Read specs/059-performance-improvements/evidence.md in full
  • Review against AGENTS.md rules (docs-only PR — public spec reference rules apply)
  • Check for private-artifact references / dependency-direction issues
  • Check for local machine-specific paths / staleness issues (per Copilot review)
  • Spot-verify source-line citations against the actual code
  • Post inline comments for findings
  • Post summary

Verdict: ship (1 nit)

This is a docs-only change (no code, AGENTS.md's code-specific rules — DPs, events, async discipline, platform suffixes — don't apply here). The relevant rule is "Public Documentation and Spec References", and this PR satisfies it: no private issues/PRs/docs are referenced, only public unoplatform/uno issue links (#24212, #24210, #24211) alongside #19381 as plain text, all one-way (public spec → public issue).

The three items flagged in the earlier Copilot review round have all been addressed in the current revision:

  • The stray "Branch" field (personal branch name) was removed.
  • All D:\Throwaway\... machine-specific paths were replaced with a <local-path> placeholder, applied consistently across §2.1–2.3.
  • "Both harnesses" was corrected to "three harnesses" in §2.

New finding (posted inline): one stale source-line citation — DependencyObject.Store.cs:2313 for AreDifferent in the F10 section should be :2192. The described behavior is still accurate; only the line number is off. I spot-checked ~10 other citations across the document (StackVector.cs, MaterializableList.cs, InsetClip.skia.cs, CompositionGeometricClip.skia.cs, BorderVisual.skia.cs, UnicodeText.cs) against the current tree and all of those were exact — this looks like an isolated slip rather than a systemic issue, but worth fixing given the document's whole premise is that every claim is independently verifiable.

No other correctness, structural, or scope concerns — the document is unusually rigorous for an evidence log (it documents its own correction transparently in F2, distinguishes measured vs. reasoned numbers throughout, and is honest about validation limits in §5.5).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new documentation includes a broken inline code identifier (split across lines with a non-ASCII hyphen) and a shell-specific command block that should be clarified for Windows reproducibility.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment on lines +82 to +86
dotnet build src/SamplesApp/SamplesApp.Skia.Generic/SamplesApp.Skia.Generic.csproj \
-c Release -f net10.0 -p:UnoFastDevBuild=true -p:UnoTargetFrameworkOverride=net10.0
export UITEST_RUNTIME_TESTS_FILTER=$(echo -n "<filter>" | base64)
cd src/SamplesApp/SamplesApp.Skia.Generic/bin/Release/net10.0
dotnet SamplesApp.Skia.Generic.dll --runtime-tests=test-results.xml
Comment on lines +562 to +564
`ResourceResolver.TryVisualTreeRetrieval` was rewritten from `(x as DependencyObject)?.GetResource‑
Dictionaries(true)` + null check to `if (scope?.Target is DependencyObject owner)`, so the struct is
enumerated directly rather than through a nullable.
property type is `bool`, and pass `value` through unchanged for every other type. This is automatic
for any `bool` DP added later.

**Why it cannot change behaviour.** `DependencyObject.AreDifferent` (`DependencyObject.Store.cs:2313`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line-number citation is off: DependencyObject.AreDifferent is actually at DependencyObject.Store.cs:2192 in the current tree, not :2313.

internal static bool AreDifferent(object? previousValue, object? newValue)
{
	if (newValue is ValueType || newValue is string)
	{
		return !object.Equals(previousValue, newValue);
	}
	...

The described behavior (value comparison via the ValueType branch) is correct — only the line number is stale. Worth double-checking since this doc's value rests on citations being exact and independently verifiable (I spot-checked ~10 other citations in this file — StackVector.cs:49/62, MaterializableList.cs:109/127-135/144, InsetClip.skia.cs:24-31, CompositionGeometricClip.skia.cs:31, BorderVisual.skia.cs:204/310 — and all of those were exact, so this looks like an isolated slip rather than a pattern).

Fix this →

@unodevops

Copy link
Copy Markdown
Contributor

@morning4coffe-dev morning4coffe-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The measured-versus-estimated distinctions, corrected warm-up comparison and explicit validation limits are useful. The remaining blocker is reproducibility/provenance: the commands require three unprovided external harness projects, while the source states are generally identified only by commit subjects or 'the merge-base of this branch'. This PR is now documentation-only, so that moving branch reference does not identify the historical measured trees. Please provide public harness/artifact locations and immutable before/after source IDs, or explicitly present the figures as historical author-reported results rather than claiming the listed commands reproduce them.

## 2. Harnesses

The three harnesses below live outside the repo (they reference it) so they never ship. They are
reproducible from the commands below, run from a local scratch directory referred to as

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] These commands cannot reproduce the measurements from a clean checkout: uno-perf-int, uno-perf-analyzer and uno-perf-bench are not included or linked, and cd/build does not create those projects. The baseline and per-fix sections also need immutable source revisions, not only commit subjects/current merge-base. Please add public reproducible harness inputs plus before/after SHAs (and preferably raw result artifacts), or qualify the text as historical author-reported evidence with the reproducibility limitation stated explicitly.

MartinZikmund and others added 3 commits October 3, 2026 10:48
Records the methodology, the harnesses, and one section per fix with its
before/after numbers, control workloads and runtime-test comparison --
including the measurement that had to be corrected, the optimisations
that were tried and rejected, and the validation limits.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015DSdL5YzLhjx8CeGXZf1Au
Adds the section for the generated bool DP setters (72 B -> 48 B per set,
exactly one box), and records two subsystems profiled for the first time
that did not yield a fix -- pointer input and template materialisation --
with their numbers and why each is spread rather than hot-spotted.

Also records what stops the work being repeated: the apparent lock
contention on the pointer path is workload setup rather than routing, and
Enum.HasFlag allocates nothing on .NET 10 (measured), so the 172-site
sweep it appeared to justify is not worth doing. Finally notes the 151
hand-written bool DP setters the generator fix does not cover.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_015DSdL5YzLhjx8CeGXZf1Au
Fix the harness-count wording ("both" -> "three"), drop the
stale personal branch reference, and replace hard-coded
D:\Throwaway paths with a <local-path> placeholder so the
commands are copy/pasteable on any machine.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0135NCgAaTksniZ1pUUzAGuE
Copilot AI lite review requested due to automatic review settings October 3, 2026 08:48
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/docs-perf-evidence branch from 5a01289 to 6c1920f Compare October 3, 2026 08:48
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 51s —— View job


Review complete ✅

  • Gather context (PR diff, prior review comments, custom instructions)
  • Read specs/059-performance-improvements/evidence.md in full (current revision)
  • Review against AGENTS.md rules (docs-only — public spec/private-artifact rules apply)
  • Check prior findings (stale :2313 citation, "Both harnesses" wording, D:\Throwaway paths) against the current revision
  • Spot-verify source-line citations against the current tree
  • Post inline comments for findings
  • Post summary

Verdict: ship (3 nits, all previously-flagged-but-unaddressed)

This is a docs-only change, so the AGENTS.md rule that actually applies is "Public Documentation and Spec References." It's satisfied: all issue links (#24212, #24210, #24211, #19381) are public unoplatform/uno references, one-way (public spec → public issue), no private artifacts.

The branch/path/wording items from the 2026-08-27 Copilot round are confirmed fixed in commit 6c1920f7 — the personal **Branch** line is gone, all D:\Throwaway\... paths are now <local-path>, and "Both harnesses" reads "three harnesses."

Three items remain open from the 2026-09-10 review round (same commit 6c1920f7 landed slightly after those reviews and didn't address them) — all low severity, posted inline:

  • The DependencyObject.Store.cs:2313 citation for AreDifferent (line 751) is still stale — and has drifted further, to :2181 now (it was :2192 when first flagged). Described behavior is still correct, only the line number is wrong.
  • The GetResourceDictionaries inline-code span (lines 562-563) is still split across a line wrap with a stray U+2011 hyphen instead of a closing backtick — doesn't copy/paste as valid C#.
  • The export ... | base64 command (line 84) is still bash-only with no note/PowerShell equivalent, despite the stated baseline being Windows 11.

Cross-cutting observation: I checked a further sample of this document's line-number citations against the current tree (StackVector.cs, MaterializableList.cs, InsetClip.skia.cs) and those still match exactly. A few composition-layer citations (UnicodeText.cs, CompositionGeometricClip.skia.cs, BorderVisual.skia.cs) have since drifted because an unrelated PR (#24821, "damage-present-seam") touched those exact files after this evidence was written — I didn't flag those individually since the doc is explicitly a point-in-time record of each commit's before/after state, not a living description of current code, so some citation decay there is an expected cost of this format rather than an authoring error. The one citation I did flag (AreDifferent) is different: it's framed as a timeless invariant ("why it cannot change behaviour"), not a point-in-time snapshot, so it's reasonable to expect it to stay accurate.

No correctness, structural, or scope concerns beyond the three nits above — the document remains unusually rigorous for an evidence log (transparent self-correction in F2, clear measured-vs-reasoned labeling throughout, honest validation-limit disclosure in §5.5). morning4coffe-dev already approved the substantive reproducibility concern raised earlier.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +198 to +199
**363 run, 358 passed, 7 skipped, 5 failed.** All 5 failures reproduce **unchanged on the baseline**
with the fix stashed (verified by rebuilding and re-running them), so none is caused by this change:
Comment on lines +291 to +295
**Fix.** Build the path once and keep it. The path depends **only on this clip's own properties** —
`RectangleClip.GetBoundsCore` reads `Left`/`Top`/`Right`/`Bottom` and ignores the `visual` argument,
and `GetBounds` then applies the clip's own `TransformMatrix` — so an override of
`OnPropertyChangedCore` drops the cached path whenever any property changes. That makes the hot path
a single null check, which is *less* work than before, not a trade.
Comment on lines +361 to +362
`Given_Visual_Damage`, `Given_UIElement`, `Windows_UI_Xaml_Shapes.*`): **671 run, 654 passed,
16 failed**, compared as sets against the F3 run — **0 new failures, 0 newly passing.**
Comment on lines +379 to +387
**Fix.** Cache the path, keyed on the `SKRoundRect` instance it was built from.
`CreateBorderPath` assigns a **brand new** `SKRoundRect` to `_borderPathOuterRect` every time it
runs (`BorderVisual.skia.cs:362-363`: `var outerRect = new SKRoundRect(); … _borderPathOuterRect = outerRect;`),
so `ReferenceEquals` is an exact cache key — a changed border geometry always produces a new
instance and therefore a cache miss. The superseded path is disposed, keeping the deterministic
native cleanup the old `using` provided.

The returned path never escapes: `GetPrePaintingClipping` either intersects it into `dst` or
transforms it into `dst`, both within the same call.
Comment on lines +404 to +405
**Correctness.** Same suite as F3/F4: **671 run, 654 passed, 16 failed**, set-compared against the
F4 run — **0 new failures, 0 newly passing.**
Comment on lines +482 to +483
**937 run, 911 passed, 6 skipped, 25 failed**, set-compared against the baseline —
**0 new failures, 0 newly passing.**
Comment on lines +660 to +661
`Given_XBind_NavigatedTo`, `Given_FrameworkElement_And_Leak`, `Given_ListViewBase`: **278 run, 270
passed, 11 skipped, 7 failed**, set-compared against a baseline build — **0 new failures, 0 newly
Comment on lines +747 to +749
**Fix.** Both generators now emit `SetValue(XProperty, Uno.UI.Helpers.Boxes.Box(value))` when the
property type is `bool`, and pass `value` through unchanged for every other type. This is automatic
for any `bool` DP added later.
property type is `bool`, and pass `value` through unchanged for every other type. This is automatic
for any `bool` DP added later.

**Why it cannot change behaviour.** `DependencyObject.AreDifferent` (`DependencyObject.Store.cs:2313`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This citation is still stale, and has drifted further since it was first flagged. DependencyObject.AreDifferent is now at DependencyObject.Store.cs:2181 (it was :2192 when this was flagged on 2026-09-10, and the doc still says :2313). The described behavior (the ValueType/object.Equals branch) is still correct — only the line number is wrong.

Given the doc's premise rests on every citation being independently verifiable, and this is the second time around without a fix, it may be worth dropping the :NNNN suffix for citations like this one that state a timeless invariant (vs. a point-in-time measurement) — a bare DependencyObject.Store.cs reference to the method name doesn't go stale the way a line number does.

Fix this →

Comment on lines +562 to +563
`ResourceResolver.TryVisualTreeRetrieval` was rewritten from `(x as DependencyObject)?.GetResource‑
Dictionaries(true)` + null check to `if (scope?.Target is DependencyObject owner)`, so the struct is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline-code span for GetResourceDictionaries is still broken across the line wrap: it ends the line with a non-ASCII hyphen (U+2011) instead of closing the backtick, so the span `(x as DependencyObject)?.GetResource‑ never closes until mid-word on the next line (`Dictionaries(true)```). This was flagged by a reviewer on 2026-09-10 ("won't copy/paste as valid C#") but is still present verbatim in this revision. Rejoining the identifier onto one line (or using a fenced code block) would fix both the broken span and the stray U+2011 character.

Fix this →

```bash
dotnet build src/SamplesApp/SamplesApp.Skia.Generic/SamplesApp.Skia.Generic.csproj \
-c Release -f net10.0 -p:UnoFastDevBuild=true -p:UnoTargetFrameworkOverride=net10.0
export UITEST_RUNTIME_TESTS_FILTER=$(echo -n "<filter>" | base64)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (previously flagged, not yet addressed): export ... | base64 is bash syntax, but §3's baseline is Windows 11. A one-line note that this block assumes bash/WSL/Git Bash (or a PowerShell equivalent, e.g. [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("<filter>"))) would make it reproducible without translation for a Windows-only reader.

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund disabled auto-merge October 3, 2026 14:01
@MartinZikmund
MartinZikmund merged commit 6e57af2 into master Oct 3, 2026
21 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/docs-perf-evidence branch October 3, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants