Skip to content

perf: coalesce COM-interop reads + allocations in reconcile path #654

Closed as not planned

Description

Background

A perf scan measured a large C# vs Rust gap on the data-grid stress workload (tests/stress_perf/StressPerf.ReactorOptimized, a StocksGrid). The dominant gap is Reconcile (~46ms C# vs ~7.9ms Rust, ~5.8x), driven largely by the diff/patch path repeatedly crossing the COM/RCW boundary and allocating per element.

Each WinRT control access — GetValue on attached DPs, RCW type-tests (is FrameworkElement), AutomationProperties reads — is expensive, and the reconciler currently repeats several of these per element, per frame. This issue tracks coalescing those redundant reads and removing per-element allocations on the reconcile/patch path.

Scope (files): src/Reactor/Core/Reconciler.cs, Reconciler.Update.cs, Reconciler.Mount.cs, Reconciler.KeyedItemsBinding.cs, AccessibilityScanner.cs (plus minimal Context/ContextScope/ComponentNode plumbing the fixes require). Behavior must be preserved exactly — coalesced COM reads must observe the same values at the same times; unmount/cleanup ordering is unchanged; the accessibility scanner must emit identical findings.

Flagship findings (attack the Reconcile gap directly)

Other reconcile/patch findings

Accessibility scanner (reconcile scan walk)

Expected impact

Removes the bulk of redundant COM round-trips and per-element allocations on the reconcile/patch path, directly reducing the ~5.8x Avg Reconcile gap and the ~39ms Avg Diff. Validated via /perf (benchmarks vs main) once that workflow merges.

Definition of done

Build (dotnet build Reactor.slnx -c Release) + unit tests (dotnet test tests/Reactor.Tests) green; mount/update/unmount selftests pass; new xUnit coverage for the rerender-delegate caching, context-change comparison, and scanner output parity.

Activity

  1. azchohfi commented on Jul 1, 2026

    @azchohfi
    CollaboratorAuthor

    Closing as not planned — below the measurement bar. #666 implemented the full COM-interop coalescing set with behavior-parity tests but was closed as an honest no-op: the effect measures below /perf harness resolution on all macro workloads (StocksGrid, KeyedList, DataGrid), and the earlier skip-floor regression did not reproduce. #769 independently re-validated on current main and the no-op verdict holds. The optimizations are real (behavior-preserving) but not resolvable on current workloads. Reopen if a COM-interop-heavy workload is added that can surface the effect.

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