Repository navigation
Description
Follow-up tracking for Yoga layout-engine work intentionally deferred from #658 / #670 (the layout-cache-guards + inline-per-node-arrays perf PR). Filing so the deferred items and one residual correctness gap surfaced by the pre-GO audit aren't lost. Scope: src/Reactor/Yoga/ only.
Deferred perf optimizations (each: why deferred / what it'd take)
-
Skip clean children in
ApplyAttachedProperties(finding fix(selftest): stabilize HostControlMountFunc + Tab/RadioButtons selection flakes #139).
Why deferred: the per-child min-content re-measure (samples(demo-script-tool): generate/re-gen fixes + session logging #140 below) is load-bearing for dirtying a leaf on content change, so blindly skipping "clean" children would drop genuine relayouts. What it'd take: maintain a precise dirty-childrenHashSetfromOnChildPropertyChangedplus a host content-change signal, then skip only provably-clean children. The flagship chore(deps): bump Microsoft.WindowsAppSDK 2.0.0-preview2 → 2.0.1 #138 setter guards + build: migrate from .NET 9 to .NET 10 (LTS) #147 attached-prop cache already removed the bulk of the per-frame cost, so this is incremental. -
Cache / skip the
ComputeMinContentre-measure (finding samples(demo-script-tool): generate/re-gen fixes + session logging #140).
Why deferred: it is currently the only mechanism that dirties a Yoga leaf when a measure-backed child's main-axis content changes (node.MinWidth = ComputeMinContent(...)→ equality-guarded setter dirties on change). Removing it would drop genuine relayouts. What it'd take: a host/reconciler→YogaNode.MarkDirtybridge on measure-backed content change (the real-Yoga contract), after which the per-pass probe can be cached perUIElementand skipped when clean. -
Delete
LayoutResults.Reset()(finding fix(cli): correct scaffolder project path and drop stale WindowsSdkPackageVersion #146).
Why deferred: dead code (no callers); the GC concern it addressed is superseded by [Bug] Controls with readonly dependency properties are not supported #142 makingCachedMeasurementa struct. What it'd take: confirm no references and delete (or gate behind the dirty-prop work).
Residual correctness gap surfaced by the pre-GO stale-state audit (please triage)
Flagged as correctness, not just perf — included here for traceability but may warrant its own priority/label.
Cross-axis measure-cache staleness after the #138 setter guards. The #138 equality guards + FlexPanel no longer re-dirtying every child each MeasureOverride correctly enable the layout cache, but they remove the implicit per-frame refresh that used to keep measure-backed leaves fresh. The #140 ComputeMinContent probe re-dirties a leaf only on a MAIN-axis min-content change — ResolveMinDimension returns Undefined for the cross axis (no probe). So a content change that alters a flex child's cross-axis size (e.g. wrapping-text height when the longest word is unchanged), or the size of a flex-basis:0 / explicit-min child, without changing main-axis min-content, leaves the Yoga leaf clean → the input-keyed measurement cache (CachedLayout/CachedMeasurements) serves a stale size. Pre-#138, the accidental per-frame re-dirty masked this. Same risk class as the already-fixed ComputedFlexBasis regression (#670), but for the measure cache rather than the resolved basis.
Exposure: narrow but real and non-self-correcting — flex items with multi-line/wrapping text whose height changes from content updates, or content-driven cross-axis sizing under basis:0/explicit-min. Common single-line cases (grid cells, labels, numbers) stay correct because their main-axis min-content tracks the change.
Candidate fixes: (a) host/reconciler → YogaNode.MarkDirty bridge when measure-backed child content changes — the faithful Yoga contract; cross-cutting (Core/Reconciler + a FlexPanel notify API), preserves the perf win. (b) FlexPanel-local: re-measure each measure-leaf at its last-resolved constraint and compare, dirtying on change — fully correct but adds a measure/child/pass (perf-sensitive, wobble/LayoutCycleException care needed). (c) Probe both axes in ComputeMinContent — changes CSS cross-axis-min semantics, not acceptable as-is.
A repro selftest (mutate a wrapping-text flex child's content without touching its Yoga style; assert the panel height updates) would pin this; the fixture lives outside src/Reactor/Yoga/.
Refs: #658, #670. Exposed by the #138 setter-equality guards.
Activity
perf(reconciler): structural-skip untouched child ranges (positional,…
perf: remove dead LayoutResults.Reset() (#681, finding #146) (#745)
test: regression guards for Yoga cross-axis measure-cache staleness (#…
azchohfi commentedon Jun 29, 2026
Resolved — all sub-items dispositioned (follow-up to #665/#670 Yoga work).
Done:
Deferred / won't-fix (with rationale):
Closing. The inline-ThemeBinding[] idea (#683 Item A) is tracked separately as deferred (cross-cuts the actively-edited reconciler; unproven value).
azchohfi commentedon Jun 29, 2026
Consolidated findings — Yoga layout-cache follow-ups (canonical revisit-ticket for the deferred bundle)
Dispositions for the three items named in this issue's title, plus the deferred-bundle revisit plan.
1. Cross-axis measure-cache staleness — RESOLVED-WITH-GUARDS ✅
Investigated repro-first. It does not reproduce on current main — it was a side-effect of the former #138 setter equality-guards, which PR #740 reverted to unconditional dirty.
FlexPanel.SyncYogaTreenow re-dirties every child node everyMeasureOverride(via theDisplay/MinWidth/Marginsetters), and a dirty node clears Yoga's constraint-keyed measurement cache (theneedToVisitNodereset inYogaAlgorithm). So a content change that grows a flex child's cross-axis size re-flows the panel even when the main-axis min-content (longest word) is unchanged. Notable: #138 was both a −39.6% Flex-rps perf regressor AND the cause of this correctness staleness — #740 fixed both.Regression guards shipped in #747 (tests-only, no production change):
YogaMeasureCacheStalenessTests(headless) — engine contract + a negative control proving the constraint-keyed cache serves a stale size without a dirty.CrossAxisMeasureStalenessFixture(selftest) — end-to-end: a wrappingTextBlockwhose line count grows (longest word unchanged) re-flows the panel (verified 19→131px tracking 18.6→130.3px child growth).2.
LayoutResults.Reset()dead-code (#146) — DONE ✅Removed in #745 (zero production callers; lone unit test removed with it; Release build 0/0 proves no callers).
3. skip-clean-children (#139) + cached-min-content (#140) — WONTFIX-WITH-FINDING ⛔
Correctness-by-construction:
ComputeMinContent's per-leafMeasure(0,∞)is currently the only mechanism that dirties a measure-backed leaf on a main-axis content change; the per-passApplyAttachedPropertiespush is the only freshness signal for measure-backed leaves. A Yoga-local cache/skip of either drops that per-pass re-dirty → reintroduces the main-axis analog of the cross-axis staleness that #747 guards against (the same #742-class regression). There is no correct Yoga-local variant; a correct version needs a cross-cutting host → reconciler →YogaNode.MarkDirtybridge (Reconciler-owned) — the same bridge that gates the inline-ThemeBinding[]item below.Ceiling A/B (throwaway optimistic-cache on
StressPerf.Flex, correctness aside, never shipped) — median of 3 reps each, percent=50, duration=10s, judged on the Flex leg's allocation surface + Renders/sec (not reconcile/diff ms):Reading: the rps gain is real (non-overlapping bands) but alloc/Gen0 are flat —
ComputeMinContentis CPU, not allocation. So even the over-optimistic upper bound (which over-skips Width/Margin changes and ignores the staleness correctness) fails the ship bar of "rps-better AND alloc-improvement", and the realized correct gain would be ≤ +15.5% rps / ~0% alloc. This is also a synthetic worst-case (≈2000 fully-realized, non-virtualized leaves, full child-tree rebuild every frame); real virtualized apps would see materially less. Business case for the bridge: a capped, alloc-neutral rps prize on a worst-case macro — not worth the cross-cutting Reconciler complexity + #742-class correctness risk on its own.4. Inline
ThemeBinding[](#167, from #683) — DEFERRED, bundled hereDeferred: it ripples into
ApplyThemeBindings/BuildCacheKeyacrossReconciler.cs/Reconciler.Mount.cs/Reconciler.Update.cs(actively edited by the Reconciler-core work), and its value is unproven (an inline-array alloc opt with no theme-binding-heavy/perfworkload). Revisit after the Reconciler-core PRs land, routing the Reconciler-side retype to that session with a measurement story first.Revisit plan (the deferred bundle)
After the Reconciler-core PRs land (clean ownership window), revisit #139 + #140 + #167 together behind the host →
MarkDirtybridge, with: (a) a theme-binding-heavy/perfleg for #167, and (b) a re-measure of #139/#140's correct (bridge-backed) gain against the ceiling above. Ship only if it clears the rps-AND-alloc bar with the bridge's correctness in place.— Yoga/theming follow-up workstream (companion to #682 #744, #745, #747; #683 Item B #749). The #683 Item B (FilterChildren ownership-contract) docs landed in #749.