Skip to content

Re-rendering full Graph after sub-graph causes Significant performance drop #86

@IuriiG

Description

@IuriiG

Expected Behavior

It should be possible to render the full graph after rendering a sub-graph without a significant performance penalty.

The following example is expected to work efficiently:

const blocks = [ /* blocks of the full graph */ ];
const connections = [ /* connections of the full graph */ ];

const graph = new Graph({ blocks, connections });

// Render a sub-graph
const { blocks: subGraphBlocks, connections: subGraphConnections } = getSubGraph(blocks, connections);

graph.setEntities({
    blocks: subGraphBlocks,
    connections: subGraphConnections,
});

// Re-render the full graph
// ⚠️ This step takes significantly longer due to recalculating styles
graph.setEntities({
    blocks,
    connections,
});

In this scenario, re-rendering the full graph after rendering the sub-graph takes around 25 seconds for ~2000 blocks, whereas the initial render of the same graph takes less than 0.5 seconds.

Image

Workaround

A temporary solution is to force a full re-render by assigning a new key to the GraphCanvas (or BlocksList) component each time setEntities is called.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions