Repository navigation
Keep unchanged types' styles stable when one type's style changes - #2687
Merged
Merged
Conversation
kmcginnes
force-pushed
the
redo-graph-style-render-perf-2-style-identity
branch
from
December 1, 2026 20:44
3e4406b to
17dfe45
Compare
This was referenced Dec 1, 2026
kmcginnes
force-pushed
the
redo-graph-style-render-perf-2-style-identity
branch
from
December 1, 2026 22:04
17dfe45 to
22163d0
Compare
Layer: 2-style-identity
Layer: 2-style-identity
Layer: 2-style-identity
The families were keyed on entity objects, so every re-derived vertex or edge, and every search result built per render, interned a new entry. The tests assert the family's keys stay bounded when a canvas entity is replaced under the same id. Layer: 2-style-identity
kmcginnes
force-pushed
the
redo-graph-style-render-perf-2-style-identity
branch
from
December 1, 2026 22:22
22163d0 to
e6a475b
Compare
kmcginnes
added a commit
that referenced
this pull request
Dec 1, 2026
## Summary Graph View built its stylesheet and resolved icons for every type in the schema, about 10k on large databases, on each style change, even when it drew 3 types. **User-facing:** style edits apply in place on both canvases. Nothing else looks different. ```diff Graph View / Schema View - useGraphStyles() - useAllVertexStyles(), useAllEdgeStyles() # every schema type - useBackgroundImageMap(all) # icon lookup for every type - → new stylesheet → cy.style(newStyles) # full re-parse per edit + useGraphStyles() # static node[type] / edge[type] mappers + mapper(element) → cache.get(type) ?? resolve(type) # only types Cytoscape draws + subscribeStyles(cy) + store.sub(user styles), iconRegistry.subscribe + → drop changed types → cy.style().update() # in place ``` ## Evidence **Before:** the picker trace spent 29 ms per commit in `useGraphStyles` and 26 ms in `cy.style`. Each expand spent 27 ms in `useGraphStyles`. **After:** both run in 0 ms per commit and per expand, and `cy.style` takes 6 ms. A test with 200 typed icons and one drawn type resolves one icon. Icons used for the first time in one style pass go out in a single registry request: 50 distinct icons make 1 request instead of 50. New tests cover in-place restyle of a vertex and an edge, a style reset, an undrawn or removed type leaving the canvas alone, a failed icon not forcing later restyles, catching up after being unsubscribed, a late-resolving icon, a type missing from the schema keeping the default style with no icon as on `main`, and a type that syncs into the schema restyling. Medians of 3 runs, dev build, measured before the final icon-batching and drawn-type changes, 10,001 vertex and 10,001 edge types, 76 nodes on the canvas, `main` → this stack: - Picker, longest task per commit: 175 → 65 ms - Picker, main-thread busy per commit: 264 → 99 ms - Expand, longest task: 258 → 217 ms - Expand, main-thread busy: 631 → 662 ms, within run-to-run noise. The rest is layout and React effects. Every picker commit still runs past one 16.7 ms frame. The remainder is Jotai store work (about 37 ms) and React passive effects, which include re-deriving the edited type's display vertices. **Verified live:** agent-tested in Chrome against a local Gremlin Server with 10,001 vertex and 10,001 edge types. Each of these restyled in place with zero stylesheet rebuilds: - Vertex shape, color, border, and icon - Edge line style, color, and arrows - Clear Customization - An edit made while Graph View was hidden showed when it came back Editing an undrawn type caused no canvas work. Schema View drew all 10,001 types, using a grid layout because fCoSE runs out of memory at this size on `main` too. ## Merge Danger **Door:** two-way. No saved data or config changes shape. **Impact:** rendering. Every canvas style now comes from the lazy cache. ## Related - Related to #2658: Schema View at 10k types now crashes in the fCoSE layout on `main` as well as on this stack - Related to #2655 - Stacked on #2687 --- <sub>🤖 Written by an AI agent on my behalf.</sub>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Editing one type's style built new style, type config, and display objects for every type in the schema. On a 10k-type schema that cost about 76 ms of store work per edit.
User-facing: the Data Explorer's Display Name and Display Description selects show the attribute the table actually uses, as the node style dialog already does. Style edits on large schemas are faster.
Evidence
Before: a single color edit invalidated every per-type atom. In the picker trace, Jotai's store update took 76 ms per commit.
After: new identity tests check that editing type A leaves type B's resolved style, type config, display config, and display vertex the same object. "ignores a display attribute stored on the schema" pins the Data Explorer selects. Display entities on the canvas keep their identity when another type's style changes, so the canvas elements are no longer rebuilt for an untouched type. The family-key tests check that replacing a vertex or edge with the same id adds no new cache entry. With the whole stack applied, the store update in the same trace dropped to 37 ms per commit.
Verified live: agent-tested in Chrome against 10,001 vertex and 10,001 edge types. Picking
codein the Data Explorer's Display Name select stored it in the user style and relabeled the hub on the canvas.Merge Danger
Door: two-way. Stored styles keep their shape.
Impact: display. Every vertex and edge label and type label reads styles per type now.
mergeEdgedrops the legacy rewrite of an edgedisplayNameAttributefrom"type"to"types". Old state survives: onmain, nothing read the patched value. Edge labels already read the resolved style, which never had the patch.Exported connection files no longer include user styles in their schema entries. Since v2.5.0, import has ignored styles in the file, because the canvas reads only stored user styles. Only v2.4.0 and older apply styles from a file, so a file exported from this build shows default styles there.
Upgrade Notes
Related
displayEdgeSelectoranddisplayVertexSelectoron ids, so search results and theuseDisplayVertexfallback no longer leave a cache entry behind on every render🤖 Written by an AI agent on my behalf.