Skip to content

feat(perf2026): Opt-in WinUI Perf2026 optimizations via XamlOptionalChanges - #24094

Open
morning4coffe-dev wants to merge 6 commits into
dev/mazi/comboboxhelperfrom
dev/doti/winui-perf-parity
Open

morning4coffe-dev wants to merge 6 commits into
dev/mazi/comboboxhelperfrom
dev/doti/winui-perf-parity

Conversation

@morning4coffe-dev

@morning4coffe-dev morning4coffe-dev commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #24093

PR Type:

✨ Feature

What changed? 🚀

Note

Stacked on #26583: the optimized ComboBox style relies on its ComboBoxHelper port. Once #26583 merges, GitHub retargets this PR to master.

This PR ports the opt-in part of WinUI 3's 2026 performance work (WinUI 3 Performance: A Leap Forward): the changes that can alter visual tree shapes or style evaluation order, and that WinUI therefore keeps behind Microsoft.UI.Xaml.Settings.XamlOptionalChanges.

The always-on optimizations originally in this PR are now separate PRs, so each can be reviewed and reverted on its own:

PR Change
#26584 Generated TemplateBinding fast path
#26585 Lazy DP store maps + DP metadata cache
#26586 WinUI PropertyPathParser port (+ propertypath sync area)
#26587 Inline storage for small DependencyObjectCollections
#26588 Direct inverse transforms
#26589 System.Threading.Lock + frozen ARIA role table
#26583 ComboBoxHelper.KeepInteriorCornersSquare (not perf, but used by the default ComboBox style)

Opting in: XamlOptionalChanges

Uno now implements WinUI's XamlOptionalChanges (until now a [NotImplemented] stub from the API sync) instead of Uno-specific FeatureConfiguration switches. The FeatureConfiguration.Perf2026 switches never shipped, so dropping them breaks nobody.

// Before Application.Start, e.g. at the top of Program.Main
XamlOptionalChanges.EnableChange(XamlChangeId.DefaultStyleOptimizations);
XamlOptionalChanges.EnableChange(XamlChangeId.OptimizeApplyStyles);
XamlOptionalChanges.EnableChange(XamlChangeId.IconNoGridOptimization);

As in WinUI, Application.Start locks the set (WinUI does it in DXamlCore::InitializeImpl), after which EnableChange/DisableChange throw InvalidOperationException (WinUI's E_ILLEGAL_STATE_CHANGE). Unknown IDs are ignored before the lock. Ported from XamlOptionalChanges_Partial.cpp and OptionalChangeState.h at WinUI 2.7.0. Not ported: WinAppSDK's containment gate (a Windows servicing kill switch).

XamlChangeId Uno effect
DefaultStyleOptimizations Overlays 11 optimized Fluent style groups (Button, CheckBox, ComboBox, Slider, ToggleSwitch, ScrollBar, AppBarButton, AppBarToggleButton, CommandBar, NavigationView back button, TabView). Zero-duration ObjectAnimationUsingKeyFrames storyboards become VisualState.Setters, and there are fewer resource lookups.
OptimizeApplyStyles A style setter that loses to a higher precedence doesn't build its value until it becomes effective. Theme/static-resource setters stay eager so their bindings register, and the winning style is re-evaluated under its original XAML scope. This is WinUI's deferred OptimizedStyle setter values (0ae9b9a7).
IconNoGridOptimization FontIcon/BitmapIcon host their TextBlock/Image directly, without the transparent Grid (2 objects and 1 layout/render level fewer per icon; 16737fe3). ImageIcon.OnApplyTemplate accepts either shape, as upstream does.
DeferContextFlyoutInit Accepted, but has no effect on Uno yet.

Runtime tests flip changes through an internal XamlOptionalChanges.SetChangeEnabledForTesting hook, the counterpart of WinUI's ResetOptionalChanges test hook.

WinUI port sync

  • New perf2026 area at WinUI 2.7.0: the eight *_themeresources_perf2026.xaml style ports plus XamlOptionalChanges.
  • NavigationBackButton_perf2026.xaml and TabView_perf2026.xaml join the existing navigationview/tabview areas.
  • CommandBar's perf2026 styles are absent from 2.7.0 (they exist only on upstream main, 55f99cde), so they get tracked once a stable tag has them.
  • The port prompt (build/winui-sync/prompt.md) no longer lists *_perf2026* variants as Not applicable, since Uno now has them: a change is ported when the area maps the Uno copy, and recorded as Skipped otherwise. The /winui-sync-onboard skill says where the variants live and which area maps them.

Validation

  • Compile: Uno.UI.UnitTests (net11.0, transitively Uno.UI and Uno.UI.FluentTheme) and SamplesApp (net11.0-desktop).
  • Unit tests: Given_XamlOptionalChanges 4/4 (defaults, enable/disable, unknown IDs, lock) and Windows_UI_Xaml.Given_Style 14/14.
  • Runtime tests (Skia desktop): Given_DefaultStyleOptimizations, Given_IconElement_NoGridContainer, Given_Style, Given_Button and Given_ComboBox: 105 passed, 1 failed, 3 skipped. The failure, Given_ComboBox.When_ComboBox_MinWidth (169.33 vs 170), is the known fractional-DPI rounding issue at this machine's 150% scale and also fails on master.
  • WinUI port sync: detect.ps1 reports perf2026, navigationview and tabview up to date. Tooling tests 133/133.

Performance

Headless Skia app with Fluent resources (x64, net10.0, DOTNET_TieredCompilation=0), one process per scenario, 4 interleaved A/B rounds against #26583 (this PR's base). Allocations are UI-thread bytes and exact: a master-vs-master null run drifted 0.00%. A time change is bold only when it is larger than that scenario's null drift and the A/B ranges don't overlap; anything else is marked noise. Background load on the machine made some timings noisy.

Scenario Allocated per iteration Δ alloc Per unit Time per iteration (median) Δ time Null drift
400 FontIcon/BitmapIcon 10,543,853 → 10,258,692 B −2.70% −713 B 18.04 → 15.19 ms −15.8% (noise) ±13.9%
Mixed page: 40 × 7 Fluent controls 90,455,344 → 90,459,020 B +0.00% +13 B 398.46 → 412.97 ms +3.6% (noise) ±3.1%
300 Fluent Buttons, built + laid out 34,623,818 → 34,656,598 B +0.09% +109 B 103.87 → 103.91 ms +0.0% (noise) ±6.8%
200k Tag set/get 0 → 0 B 0 — 19.17 → 19.55 ms +2.0% (noise) ±6.1%
400 FontIcon/BitmapIcon — switches on 10,543,892 → 7,550,666 B −28.39% −7.3 KB 17.20 → 10.64 ms −38.1% ±13.9%
Mixed page: 40 × 7 Fluent controls — switches on 90,455,374 → 87,422,858 B −3.35% −10.6 KB 347.18 → 344.50 ms −0.8% (noise) ±3.1%
300 Fluent Buttons, built + laid out — switches on 34,687,963 → 34,519,816 B −0.48% −560 B 100.52 → 112.38 ms +11.8% (noise) ±6.8%
300 Buttons with local values overriding the style — switches on 35,196,792 → 34,988,434 B −0.59% −695 B 94.60 → 105.28 ms +11.3% (noise) ±1.2%
100 Button/CheckBox × 4 visual-state changes — switches on 745,661 → 714,459 B −4.18% −78 B 2.35 → 1.87 ms −20.2% (noise) ±7.7%
100 editable ComboBoxes, built + laid out — switches on 78,470,640 → 77,297,201 B −1.50% −11.5 KB 383.57 → 359.97 ms −6.2% (noise) ±12.2%

With the switches off, this PR is allocation-neutral apart from a −713 B saving per icon from the reworked BitmapIcon/FontIcon code (the +109 B per Button is a +0.09% difference). With all three XamlChangeIds on:

  • IconNoGridOptimization removes 7.3 KB per icon (−28%) and makes the icon scenario 38% faster.
  • DefaultStyleOptimizations saves about 10.6 KB per control on the mixed page and 78 B per visual-state change.
  • OptimizeApplyStyles saves about 700 B per Button whose style values are overridden locally.

The large Button win belongs to #26584, which is why it doesn't appear here.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNu1LMuUpziGZWHVDmpX

@morning4coffe-dev morning4coffe-dev added kind/enhancement New feature or request area/code-generation Categorizes an issue or PR as relevant to code generation area/performance 📈 Categorizes an issue or PR as relevant to performance labels Aug 17, 2026
@github-actions github-actions Bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/automation Categorizes an issue or PR as relevant to project automation kind/documentation labels Aug 17, 2026
@github-actions

github-actions Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 10m 29s —— View job


PR Review: perf: port WinUI Perf2026 optimizations

Tasks

  • Load review tools
  • Review core runtime changes (BindingExpression, DependencyObjectStore, DependencyObjectCollection)
  • Review property path parser changes
  • Review style/icon/transform changes
  • Review source generator changes
  • Review XAML theme resources
  • Review test coverage
  • Post inline comments and summary

Overall Verdict: fix-first on three minor items; architecture and test coverage are excellent

The PR is a high-quality, well-structured port. The allocation wins are real and well-measured, the opt-in design is clean, and the test suite is thorough (unit tests for every changed hot path, new runtime tests, new generator snapshots). The findings below are all correctable before merge.


Issues by Severity

Medium — 3 findings (all on the same pattern)

TryTransformInverse return value silently ignored in three call sites:

File Line
src/Uno.UI/UI/Xaml/Input/PointerRoutedEventArgs.wasm.cs 19
src/Uno.UI/UI/Xaml/Controls/Flyout/FlyoutBase.Pickers.cs 52
src/Uno.UI.Runtime.Skia.WebAssembly.Browser/Extensions/BrowserDragDropExtension.cs 361

In all three cases, ContextRequestedEventArgs.cs (in this same PR) correctly checks the return value and skips the transformation when the transform is not invertible. The three affected sites swapped the old NRE crash (on a null Inverse) for a silent wrong-coordinate fallback: when the transform is non-invertible, the absolute point is silently used as the relative position. Inline comments with suggested fixes have been posted on each.

Low — 1 finding

DependencyPropertyDetailsCollection.cs hot-reload binding clone (line 70): when DependencyProperty.GetProperty(...) returns null for a renamed/removed DP during hot reload, the fast-path template binding is silently dropped with no log. The old classic-binding path has equivalent gaps, but a Debug log here would make hot-reload binding loss diagnosable.


Low / Code Clarity

  • ResourceDictionary.OverlayFrom: the if (value is LazyInitializer lazy) check inside the else branch of the theme-dictionary loop appears unreachable after the preceding TryGetValue materialisation call. Either confirm it can be reached and add a comment, or remove it.
  • BitmapIcon.cs line 66: comment says "ImageSourceConverter" but the actual mechanism is the implicit operator ImageSource?(Uri) on ImageSource. Mildly misleading — see inline comment.
  • XamlFileGenerator.cs line 4241: the attached-DP-as-target case for TemplateBinding is correctly excluded by the prefix.EndsWith(".") guard, but a generator snapshot test for that shape would lock in the expected output.

Cross-cutting Observations

TemplateBinding fast path — design is correct: the BindingExpression(sourceProperty, sourcePath) constructor calls ApplyTemplateBindingParent() immediately; deferred re-application via SetTemplatedParent2(reapplyTemplateBindings) and ApplyTemplateBindings() is correctly wired. The _subscription field is null for fast-path expressions and all access sites use ?. — no NPE risk.

DependencyObjectCollection InlineArray — the Spill() transition (inline → List<T>) is one-way and correct; _spilledItems becomes sole storage and the inline slots are zeroed to avoid GC-pinned references. The lock-free lazy lock object via Interlocked.CompareExchange is sound.

System.Threading.Lock — the switch from object to Lock in NativeDispatcher and WeakReferencePool is correct for .NET 9+ and benefits from the runtime's faster Lock implementation. .crossruntime.cs files correctly target both WASM and Skia where .NET 9+/10 is guaranteed.

MetadataAPI reflection cache — the negative-caching logic (property is not null || member is null) is sound: a member that exists but reads back null is not cached (static initializer may not have run yet), while a truly absent member is cached as null permanently.

Style.TryDeferSetter — the precedence comparison GetBaseValueSourcePrecedence(property) < precedence (falling through to return true) correctly defers a setter when an existing base value has higher priority (lower enum value). The ClearResourceBindingsForSkippedSetter call mirrors the binding-cleanup that applying the setter would have performed, preserving theme-binding correctness.

BitmapIcon binding → DP callback — ImageSource has implicit operator ImageSource?(Uri) so the cast (ImageSource)uriSource is valid for both null (reset) and non-null values, and _image is not null guards construction ordering. Semantics are equivalent to the old binding.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

Comment thread src/Uno.UI/UI/Xaml/Style/Style.cs Fixed
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 228103 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Focus_FocusVisual_Properties.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Buttons.png-dark
    • Buttons.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • Image_AnimatedWebP.png-dark
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png
    • ApplicationViewSizing.png
    • AppWindowPositionAndSize.png-dark
    • AppXamlDefinedResources.png-dark
    • AutoBorderStretchwithleftmargin.png-dark
    • AutoSizedTopLeft.png
    • AutoSuggestBox_SoftKeboard.png
    • BasicThemeResources.png-dark
    • BitmapIcon_Generic.png-dark
    • BitmapIcon_Generic.png
    • BorderRightwithmargins.png
    • BorderTopwithmargins.png-dark
    • Border_CornerRadius_Binding.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_With_CompositeTransform.png-dark
    • Border_With_CompositeTransform.png
    • Button_Enabled_Control_Disabled.png-dark
    • Button_Enabled_Control_Disabled.png
    • Capture with overlap.png-dark
    • Capture with overlap.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming

@github-actions

github-actions Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 4m 43s —— View job


PR Review: perf: port WinUI Perf2026 optimizations

Tasks

  • Load review tools
  • Check if previous review findings were addressed (TryTransformInverse, hot-reload logging, dead code, misleading comment)
  • Review new/updated files for fresh issues
  • Post inline comments for any remaining/new findings
  • Post summary

Overall Verdict: ship — all prior findings addressed, no new blocking issues

The fix(perf): address CI and review findings commit cleanly resolves every item from the first review pass. No new correctness issues found in the updated code.


Previous Findings — All Resolved ✅

Finding File Status
TryTransformInverse return silently ignored PointerRoutedEventArgs.wasm.cs ✅ Fixed — now checks return, falls back to absolute
TryTransformInverse return silently ignored FlyoutBase.Pickers.cs ✅ Fixed — explicit if (!...) relativeLocation = rect.Location
TryTransformInverse return silently ignored BrowserDragDropExtension.cs ✅ Fixed — conditional expression with fallback
Hot-reload binding clone drop, no log DependencyPropertyDetailsCollection.cs ✅ Fixed — Debug log when fast-path clone fails
Dead code LazyInitializer check in else ResourceDictionary.cs ✅ Removed
Misleading ImageSourceConverter comment BitmapIcon.cs ✅ Updated to reference implicit operator
Nested if in GetStyleFromChannel Style.cs ✅ Combined with &&
CodeQL: container contents never accessed Given_DependencyObjectCollection.InlineStorage.cs ✅ Added Assert.AreEqual / Assert.AreSame
CodeQL: generic catch in BindingExpression BindingExpression.cs ✅ Added IsFatalException helper with exception filter
CodeQL: generic catch in dispatcher concurrency test Given_NativeDispatcher_Concurrency.cs ✅ Added when (!IsFatalException(error)) filter

Remaining Observations (non-blocking)

Low / test coverage gap

A snapshot test for {TemplateBinding} with an attached-property target (e.g. Grid.Row="{TemplateBinding ...}") is still absent. The new When_TemplateBinding_Can_Use_DependencyProperty_Fast_Path test covers the fast path and attached DP as source; the fallback path for attached DP as target (where prefix.EndsWith(".", ...) is false and the generator correctly falls through to SetBinding) has no locked snapshot. This is a minor gap — the guard logic is correct, no snapshot means a future refactor could silently change the generated output for that shape.

Low / cosmetic (CodeQL, no behavioral impact)

  • __nameScope field in the generated snapshot XamlCodeGenerator_MainPage_d6cd66944958ced0c513e0a04797b51d.cs could be readonly — this is generator-emitted output; fixing it would require a generator template change and is cosmetic.
  • The foreach over _logicalScopeStack in XamlFileGenerator.cs:GetCurrentControlTemplateTargetType (around line 5647) could filter with .Where(...) per the CodeQL hint — stylistic only.

Code Quality Observations (cross-cutting, unchanged from first pass)

The overall quality of this PR remains high:

  • The IsFatalException helper in BindingExpression cleanly avoids swallowing OutOfMemoryException/StackOverflowException/AccessViolationException — correct pattern.
  • The Perf2026Resources.xaml.cs #if !__NETSTD_REFERENCE__ guard around InitializeComponent() and style registration is the correct fix for the reference-assembly build failure.
  • The FindDescendantByName replacement for GetTemplateChild in Given_Style.cs correctly handles deferred template materialization cases where the template child may not be immediately accessible via the typed helper.
  • Screenshot diffs (57 Skia Linux, 2348 Skia Windows, 11 WASM) need visual baseline validation by the author — the Skia Windows count is very high and may indicate the Perf2026 control styles have visible rendering changes or a stale baseline. This should be checked before merge.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 3m 36s —— View job


PR Review: perf: port WinUI Perf2026 optimizations

Tasks

  • Load review tools
  • Review PR diff for new issues since last review
  • Check remaining gap (attached-property target snapshot test)
  • Post inline comments
  • Post summary

Overall Verdict: ship — all prior gaps closed, new commits clean

The four commits added since the second review pass cleanly address everything that was open:

Commit What it does Status
23b7b978 Adds When_TemplateBinding_Targets_Attached_Property snapshot test ✅ Closes remaining gap
8d0cd1ec ImageIcon.OnApplyTemplate handles direct Image child (Perf2026 path) ✅ Correct
86d9788a Indexer-set on DependencyObjectCollection no longer bumps _version, matching List<T> semantics ✅ Correct, tested
5a02e56c TryGetIntIndex uses (uint)(c - '0') > 9 (ASCII-only, matching std::iswdigit) and int.TryParse with NumberStyles.None instead of throwing on overflow ✅ Correct

No new findings. No inline comments to post.


Verification of the attached-property target snapshot (WhTeBiTaAtPr)

The snapshot for Grid.Row="{TemplateBinding TabIndex}" confirms the fast path correctly emits:

global::Uno.UI.Xaml.BindingHelper.SetTemplateBinding(
    __p1,
    global::Microsoft.UI.Xaml.Controls.Grid.RowProperty,   // target: attached DP
    global::Microsoft.UI.Xaml.Controls.Button.TabIndexProperty,
    @"TabIndex");

SetTemplateBinding(__p1, Grid.RowProperty, ...) is correct — SetValue(Grid.RowProperty, value) works on any DependencyObject, so the attached-property case is handled identically to a regular DP on the generated side. The snapshot locks in the expected output for future refactors.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 229951 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • ButtonClippingTestsControl.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ButtonClippingTestsControl.png-dark
    • ClipboardTests.png-dark
    • ImageIconPage.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
  • skia-windows-screenshots: 2348 changed over 2396

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ApplicationViewMode.png
    • AppWindowPositionAndSize.png-dark
    • AppWindowTitleBar Properties.png-dark
    • Attributed_text_Supserscript.png-dark
    • AutomationPropertiesExtensions_Role.png-dark
    • AutoSuggestBox_Description.png
    • BasicAutoSuggestBox.png-dark
    • Battery.png
    • BezierSegment.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BorderLeftwithmargins.png-dark
    • BorderLeftwithmargins.png
    • Border_Clipped_Change_Property.png-dark
    • Border_Clipped_Change_Property.png
    • Border_Simple_with_Opacity.png
    • Border_Simple_with_Uniform_Thickness.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CameraCaptureUISample.png
    • Canvas_In_Canvas.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Uno_Web.Http.CookieManagerTests
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 2m 30s —— View job


PR Review: perf: port WinUI Perf2026 optimizations

Tasks

  • Load review tools
  • Review new commits since last review (d9bffdf, b0889d2, ab9bd9b)
  • Check for any new issues or regressions
  • Post inline comments
  • Post summary

Overall Verdict: ship — new commits are clean, one remaining nit

The three commits added since the third review pass are all mechanical:

Commit What it does Status
d9bffdf5 Merge master into branch ✅ Clean
b0889d23 Refresh TemplateBinding snapshot hashes after master merge (path format change altered the generator hash from d6cd… to 0e3f…) ✅ Correct mechanical refresh
ab9bd9b2 Add public void InitializeComponent() stub under #if __NETSTD_REFERENCE__ to align the reference API surface with what the XAML source generator emits for ResourceDictionary subclasses ✅ Correct — confirmed by XamlFileGenerator.cs:1899 which emits public void InitializeComponent() for ResourceDictionary types

No new correctness issues found.


One Remaining Nit (non-blocking)

Given_MetadataAPI_DependencyPropertyCache.cs:120 — redundant .ToString() in string concatenation (CodeQL carry-over from prior review passes). Inline suggestion posted.


Prior Findings — All Resolved ✅

All findings from reviews 1 and 2 were resolved in 9c4e403. All gaps from review 3 were closed by 23b7b978 and 8d0cd1ec. Nothing regressed in the new commits.

Screenshot diffs (57 Skia Linux, 2348 Skia Windows, 11 WASM) remain open for the author to validate visually — the high Skia Windows count is expected given the control-style and icon-layout changes in this PR, but the author should confirm baselines are acceptable before merge.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 247267 found UI Test snapshots differences: skia-linux-screenshots: 234, skia-windows-screenshots: 256

Details
  • skia-linux-screenshots: 234 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_Showcase.png
    • AnimatedBackVisualSourceSamplePage.png
    • AutomationProperties_AutomationId.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • Accessibility_Showcase.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_AutomationId.png
    • Basics.png-dark
    • Basics.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • AnimatedVisualsTestbedPage.png
  • skia-windows-screenshots: 256 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_AutomationId.png
    • BasicAcrylicBrushTest.png-dark
    • BasicAcrylicBrushTest.png
    • AutomationProperties_AutomationId.png-dark
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • ClipboardTests.png-dark
    • Accessibility_Showcase.png-dark
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • AnimatedBackVisualSourceSamplePage.png
    • AppWindowTitleBar Properties.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • AnimatedBackVisualSourceSamplePage.png-dark

morning4coffe-dev and others added 5 commits November 18, 2026 11:36
Optimized Fluent styles, deferred overridden setter values and grid-less
FontIcon/BitmapIcon.

Co-Authored-By: Martin Zikmund <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu1LMuUpziGZWHVDmpX
Implements Microsoft.UI.Xaml.Settings.XamlOptionalChanges, locked when
Application.Start runs, and drives the Perf2026 optimizations from it
instead of the FeatureConfiguration.Perf2026 switches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu1LMuUpziGZWHVDmpX
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 18s —— View job


PR Review: perf: port WinUI Perf2026 optimizations (eleventh pass)

Verdict: ship, with description cleanup. There are no inline findings.

Scope and limits: this was a read-only pass. I didn't build or run tests. The origin/dev/mazi/comboboxhelper base ref isn't in this checkout, so I couldn't produce the full PR diff. I read the newest commit, 3dec2321 (WinUI sync tracking), and XamlOptionalChanges.cs, which comes from the opt-in commits.

Checked

  • areas.json paths: every Uno path in the new perf2026 area, plus the NavigationView and TabView additions, matches a file in this PR's changed-files list. The upstream paths can't be checked from this checkout. CommandBar_themeresources_perf2026.xaml is left out of the area on purpose, as your commit message explains.
  • XamlOptionalChanges:
    • The lock and lock-state handling is coherent.
    • EnableChange/DisableChange throw after Lock(), as in WinUI.
    • The Uno-only skip of the "query before init" fail-fast is documented with a TODO.
    • SetChangeEnabledForTesting is internal.

Non-blocking

  • Torn reads on 32-bit targets: _enabledChanges is a plain ulong and is read without the lock. A reader could see a torn value on a 32-bit runtime. The writes all complete before init locks the set, so this is unlikely to matter in practice. Volatile.Read or Interlocked.Read would make it airtight at negligible cost.
  • Stale PR description (also flagged in earlier passes):
    • The WebAssembly DOM batching section and its measurement rows describe code that master's native-rendering removal dropped.
    • The Perf2026Resources reference-assembly InitializeComponent() stub note and the ReferenceImplComparer validation no longer apply, because the stub was removed.
    • The validation build lines still list Uno.UI.FluentTheme.v2.{Reference,Skia,Wasm}.
    • The description still advertises the FeatureConfiguration.Perf2026.EnableAll flag, while recent commits moved opt-in to XamlOptionalChanges. Please reconcile this with doc/articles/feature-flags.md.
  • Screenshot diffs: the latest run shows 234 changed on Skia Linux and 256 on Skia Windows, out of 2496. That is a different shape from the 57 / 2310 / 11 counts the description cites as shared-baseline noise. Please confirm they aren't caused by this PR, for example by comparing against a master run.
    · Branch: dev/doti/winui-perf-parity

@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on 3dec232

The Uno.WinAppSDKSyncGenerator produced changes that are not committed on this PR.

To apply automatically (PRs from branches in this repo only): comment /apply-sync-gen on this PR and a bot will push chore: Sync generator run to the head branch.

To apply manually (required for PRs from forks):

  1. Download the sync-generator-patch artifact from this run.
  2. In your local checkout of the PR branch:
    git apply sync-generator.patch
    git add -A
    git commit -m "chore: Sync generator run"
    git push
    

Or re-run the generator locally on Windows via build\run-api-sync-tool.cmd.

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.

🔵 Needs a closer look

Human runtime review is needed because the PR combines global gating, deferred styles, resource overlays, and numerous Fluent template changes whose cross-platform theme, visual-state, and accessibility behavior cannot be fully validated statically.

No open issues 🎉

4 resolved since last review

Review effort: Lite

Uno now has perf2026 style variants under Uno.UI.FluentTheme/Perf2026,
so the port prompt no longer lists `*_perf2026*` changes as Not
applicable. A change is ported when the area maps the Uno copy, and
recorded as Skipped otherwise, so new upstream variants surface.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNtzDYsFtkCZh1wz4Lkf
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 18s —— View job


PR Review: opt-in Perf2026 via XamlOptionalChanges (twelfth pass)

Verdict: ship, with description cleanup. No new inline findings.

Scope and limits: this was a light, read-only pass. I read src/Uno.UI/UI/Xaml/Settings/XamlOptionalChanges.cs and the commit list (85946813 is the newest). I didn't build or run tests. I also didn't re-read the Style, icon or ResourceDictionary changes, so this pass adds nothing on them beyond the earlier reviews.

Checked

  • Lock semantics: EnableChange and DisableChange throw after Lock(). Unknown IDs return false before the lock. SetChangeEnabledForTesting is internal. All of this matches the PR description.
  • Fail-fast skip: the Uno-only skip of WinUI's "query before init" fail-fast is documented with a TODO.

Non-blocking

  • Unlocked reads: _enabledChanges is a plain ulong read without the lock, in IsChangeEnabled and IsOptionalChangeEnabled. A reader could see a torn value on a 32-bit runtime. Writes finish before init locks the set, so this is unlikely to matter in practice. Volatile.Read would close it at negligible cost. This repeats the previous pass's note.
  • PR description: a few points (also raised in earlier passes) no longer match the tree:
    • The WebAssembly DOM batching section and its measurement rows describe code that master's native-rendering removal dropped.
    • The Perf2026Resources reference-assembly InitializeComponent() stub note and the ReferenceImplComparer validation no longer apply, because the stub was removed.
    • The validation build lines still list Uno.UI.FluentTheme.v2.{Reference,Skia,Wasm}.
    • The FeatureConfiguration.Perf2026.EnableAll flag is still advertised, though opt-in moved to XamlOptionalChanges. Please reconcile this with doc/articles/feature-flags.md.
  • Sync generator drift: the check reported drift on 3dec232. Comment /apply-sync-gen, then push a commit to re-run CI, as in the earlier round.
  • Screenshot diffs: the latest run shows 234 changed on Skia Linux and 256 on Skia Windows, out of 2496. Please confirm they aren't caused by this PR, for example by comparing against a master run.
    · Branch: dev/doti/winui-perf-parity

@MartinZikmund
MartinZikmund force-pushed the dev/doti/winui-perf-parity branch from 8594681 to dfe419a Compare November 19, 2026 06:57
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 32s —— View job


PR Review: opt-in Perf2026 via XamlOptionalChanges (twelfth pass)

Verdict: ship, with one non-blocking item and a description cleanup.

Scope and limits: this was a read-only pass of the opt-in diff (XamlOptionalChanges, Style.cs, IconElement.cs, Application.cs). I didn't build or run tests (code review only, no compile or runtime validation).

Severity count: 0 blocking, 1 medium (inline), 2 nits.

Medium (inline): Style.TryGetPropertyValue pushes a resource scope on every call, including with all switches off. That is an always-on cost on a lookup path, so it conflicts with the "allocation-neutral when off" claim.

Checked, looks correct

  • Application.StartPartial locks the set before any XAML init, matching WinUI's DXamlCore::InitializeImpl.
  • TryDeferSetter: the >= early-return defers only when an existing base value has higher precedence. The Copilot "inverted" finding was already correctly rejected. Theme-resource setters stay eager.
  • IconElement direct-child path: IsViewHit preserves hit-testing of the removed transparent Grid. _usesDirectChild is cached per instance, which is safe because the set is locked after start. Test hooks can flip it, so that's a test-only concern.
  • The optimized style channel is separate (_optimizedLookup/_optimizedDefaultStyleCache) and falls back to the default channel. ALC sweep covers both caches.

Nits (non-blocking)

  • XamlOptionalChanges._enabledChanges is a plain ulong read without the lock. A reader can tear on 32-bit runtimes such as WASM. Volatile.Read would fix that at negligible cost.
  • Given_XamlOptionalChanges covers the lock. Consider also a unit test that Application.Start locks the set, since that wiring is untested.

Description is stale (carried over from earlier passes): the WASM DOM batching section, the FeatureConfiguration.Perf2026 references and the Perf2026Resources reference-stub/ReferenceImplComparer notes no longer match the tree. The old screenshot-diff counts also differ from the latest run (234 Skia Linux / 256 Skia Windows). Please compare against a master run and confirm they aren't from this PR.
· Branch: dev/doti/winui-perf-parity

@mergify

mergify Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

// The setter may resolve resources, which must happen in the scope the Style was declared in,
// exactly as it would have during ApplyTo. This matters for deferred setters, whose value is
// only built when this method is reached through DependencyObject.ReevaluateBaseValue.
ResourceResolver.PushNewScope(_xamlScope);

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.

TryGetPropertyValue now pushes/pops a resource scope on every call, even with all XamlChangeIds off. It's reached from FrameworkElement.mux.cs:56 and Control.mux.cs:244 (the property-value lookup path), so this is an always-on cost and a behavior change, which conflicts with the PR's "allocation-neutral with switches off" claim.

Consider pushing the scope only when setter is a deferred, not-yet-materialized setter, or when IsOptimizeApplyStylesEnabled is true. Otherwise keep the previous direct call. Either way, please confirm via the benchmark that the flag-off path isn't regressed.

@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on dfe419a

The Uno.WinAppSDKSyncGenerator produced changes that are not committed on this PR.

To apply automatically (PRs from branches in this repo only): comment /apply-sync-gen on this PR and a bot will push chore: Sync generator run to the head branch.

To apply manually (required for PRs from forks):

  1. Download the sync-generator-patch artifact from this run.
  2. In your local checkout of the PR branch:
    git apply sync-generator.patch
    git add -A
    git commit -m "chore: Sync generator run"
    git push
    

Or re-run the generator locally on Windows via build\run-api-sync-tool.cmd.

@github-actions

Copy link
Copy Markdown
Contributor

WinAppSDK sync generator drift detected on 8594681

The Uno.WinAppSDKSyncGenerator produced changes that are not committed on this PR.

To apply automatically (PRs from branches in this repo only): comment /apply-sync-gen on this PR and a bot will push chore: Sync generator run to the head branch.

To apply manually (required for PRs from forks):

  1. Download the sync-generator-patch artifact from this run.
  2. In your local checkout of the PR branch:
    git apply sync-generator.patch
    git add -A
    git commit -m "chore: Sync generator run"
    git push
    

Or re-run the generator locally on Windows via build\run-api-sync-tool.cmd.

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

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure area/code-generation Categorizes an issue or PR as relevant to code generation area/performance 📈 Categorizes an issue or PR as relevant to performance area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation kind/enhancement New feature or request platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align Uno XAML performance with WinUI Perf2026

6 participants