Skip to content

perf(erd): route search state in flat generation-stamped arrays (#1168) - #1238

Merged
ZhuchkaTriplesix merged 2 commits into
devfrom
perf/1168-erd-router-drag
Oct 9, 2026
Merged

ZhuchkaTriplesix merged 2 commits into
devfrom
perf/1168-erd-router-drag

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Refs #1168

What was done already

PR #1187 rasterized the obstacles and coalesced drag moves into one route per frame. This PR is the next item of the issue.

Changes

  • The A* search kept cost, predecessor, start and closed state in HashMaps and Sets, boxed on every access. The state now lives in typed arrays (Float64List, Int32List) sized once per grid, one entry per (cell, direction).
  • A generation stamp per search marks the valid entries, so nothing is cleared between the relations of one route() call.
  • Search order, heuristic and result are unchanged; the existing route tests cover that.
  • A 100-table test checks that every relation routes with at least two points.

Not in this PR

  • The benchmark in benchmark/ and in the benchmark workflow (the issue's acceptance timing). A timing assertion would be flaky on shared CI runners, so it needs a design (a report, not a gate).
  • Incremental re-routing (only the edges of the moved table) is not done; that is the larger part of the issue.
  • Memory: the arrays are allocated per route() call, so one drag move allocates them again. A later change can keep them on the grid between frames.

Not verified locally

Tests were not run locally, per the project rule.

The grid search kept cost, predecessor, start and closed state in hash maps and
sets, one entry per expanded state, boxed on every access. The state now lives
in typed arrays sized once per grid, with a generation stamp per search, so
nothing is cleared between the relations of a route. The search order and the
result are unchanged; a 100-table schema test checks every relation routes.
@github-actions github-actions Bot added frontend Theme parser epic label: frontend performance Theme parser epic label: performance P2 Medium priority / Parity & Refactoring labels Oct 9, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 2454799 into dev Oct 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Theme parser epic label: frontend P2 Medium priority / Parity & Refactoring performance Theme parser epic label: performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant