Skip to content

perf(macos): faster ER diagram layout and drag, inspector row changes and blob cells - #4231

Merged
datlechin merged 2 commits into
mainfrom
fix/perf-views
Nov 12, 2026
Merged

datlechin merged 2 commits into
mainfrom
fix/perf-views

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • ER layout (ED-03): the force pass indexes each FK component by member order in arrays instead of UUID dictionaries, same arithmetic in the same order, so positions are unchanged. CPU per layout: 300-table component 1,104 to 11.4 ms, 1,000 tables 13,228 to 136 ms (swiftc -O harness, bit-identical output on 11 graphs).
  • A superseded layout stops: ERDiagramLayout.layOut is @concurrent and awaited inside layoutTask, so Reset Layout, Compact Mode and Collapse Junctions cancel the run they replace. The unstructured Task.detached before never saw the cancel.
  • Row inspector (ED-04): a field's identity is its column, so a new selection updates the list in place. Single-line, boolean and enum editors follow the new value in place; editors that seed state from the value still start over per row through editorID. Row step, 30 columns: 129.5 to 62.9 ms, 121 to 84 views built (hosted Debug probe).
  • Blob cells (ED-05): grid, copy, inspector and value viewer hex read only the bytes they show, with the same Latin-1 or UTF-8 rule as storedBytes. Per 4 MB cell: .bytes grid 8.5 to 0.001 ms, Latin-1 text grid 35.5 to 0.44 ms, hex dump 15.1 to 0.09 ms. Output identical on 103k generated inputs.
  • ER drag (ED-07): with VoiceOver or another client reading the diagram, a scene that only moved tables moves the held elements instead of rebuilding all of them, and one layoutChanged goes out when the drag ends. Edges outside the redrawn rect are not stroked; routes are reused until the scene changes. 500 tables: 4.74 to 0.034 ms per drag event, 1200x800 redraw 23.5 to 10.9 ms (Debug).
  • MultiRowEditStateExpansionTests.expansionSurvivesSelectionChange now checks editorID, since id no longer changes with the selection.

Needs the maintainer

  • ED-04 is partly done: the inspector's fields are still configured on each selection while the inspector is hidden (about 5 ms for a 10,000 x 30 Select All). Skipping that changes when unsaved inspector edits are dropped, which Save and the close prompt read.

Test plan

  • New: ERDiagramLayoutTests (cancelled layout throws, positions recorded from the old layout), ERDiagramEdgeCullingTests, ERDiagramAccessibilityTests (column change, added table), MultiRowEditStateTests (field and editor identity), InspectorRowChangeTests (in place vs rebuilt editors), StringHexDumpTests (prefix reads).
  • The ER diagram, inspector, blob and cell display suites pass locally.

@datlechin
datlechin enabled auto-merge (squash) November 12, 2026 07:07
@datlechin
datlechin merged commit 3096fa8 into main Nov 12, 2026
11 checks passed
@datlechin
datlechin deleted the fix/perf-views branch November 12, 2026 08:29
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.

1 participant