Skip to content

Some more perfomance hammering - #35

Merged
carl-andersson-at-westermo merged 5 commits into
mainfrom
perf/revisit
Sep 29, 2026
Merged

carl-andersson-at-westermo merged 5 commits into
mainfrom
perf/revisit

Conversation

@carl-andersson-at-westermo

Copy link
Copy Markdown
Collaborator

No description provided.

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.

Copilot review overview

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

This PR applies allocation and layout-cache optimizations across Avalonia graph controls.

Changes:

  • Coalesces deferred viewport and vertex-position updates.
  • Adds label tracking and lookup optimizations in GraphArea.
  • Adds edge geometry caching and removes the Avalonia viewfinder control.
File Description
Westermo.GraphX.Controls.Avalonia/​Controls/​ZoomControl/​ZoomControl.cs Updated as part of this pull request.
Westermo.GraphX.Controls.Avalonia/​Controls/​ZoomControl/​Wayfinder.cs Updated as part of this pull request.
Westermo.GraphX.Controls.Avalonia/​Controls/​ZoomControl/​ViewFinderDisplay.cs Updated as part of this pull request.
Westermo.GraphX.Controls.Avalonia/​Controls/​VertexControlBase.cs Updated as part of this pull request.
Westermo.GraphX.Controls.Avalonia/​Controls/​VertexControl.cs Updated as part of this pull request.
Westermo.GraphX.Controls.Avalonia/​Controls/​GraphArea.cs Updated as part of this pull request.
Westermo.GraphX.Controls.Avalonia/​Controls/​EdgeControlBase.cs Updated as part of this pull request.

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

Comment thread Westermo.GraphX.Controls.Avalonia/Controls/EdgeControlBase.cs Outdated
Comment thread Westermo.GraphX.Controls.Avalonia/Controls/EdgeControlBase.cs Outdated
Measure edge pointers before the geometry reuse check so DesiredSize changes invalidate the cached geometry on the first pass. Add a regression test that changes pointer size between measures and verifies the edge geometry is rebuilt immediately.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Copilot review overview

🔵 Needs a closer look

One or more issues must be addressed before approval.

Review effort: Lite
Findings: None

Resolved since last review (2)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Cache key omits endpoint and routing inputs

Westermo.GraphX.Controls.Avalonia/​Controls/​EdgeControlBase.cs:1365

This reuse key is incomplete for the geometry that is skipped below: UpdateConnectionPoints also consumes OverrideEndpoint and the edge's source/target connection-point IDs, while UpdatePoints/PrepareEdgeLayout consume the graph routing settings and ReversePath. For example, EdgeControl.Drag changes OverrideEndpoint and only invalidates measure; with the same vertex rects and route this check returns true, so the preview edge keeps its old endpoint. Include every input used by the skipped geometry computation (or explicitly invalidate/reset this cache when those inputs change).

This issue also appears on line 1374 of the same file.

CheckGeometryReusability was missing several inputs consumed by the geometry recompute path it gates: OverrideEndpoint, source/target connection-point IDs, ReversePath, and the graph's edge-routing settings (IsEdgeRoutingEnabled/EdgeCurvingTolerance). Changing any of these without also changing vertex rects or the route could leave the reuse path returning true and skip recomputing points/geometry.

Also add an explicit reversePathChanged dirty-flag check in UpdateCacheInfo: ReversePath only reverses traversal order when the final StreamGeometry is built and never mutates the cached point values, so the existing point-value comparison alone cannot detect a ReversePath-only change.

Add a regression test covering the ReversePath case.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@carl-andersson-at-westermo
carl-andersson-at-westermo merged commit 7eacdc7 into main Sep 29, 2026
4 checks passed
@carl-andersson-at-westermo
carl-andersson-at-westermo deleted the perf/revisit branch September 29, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants