Skip to content

Conversation

@SerhiiTsybulskyi
Copy link
Contributor

@SerhiiTsybulskyi SerhiiTsybulskyi commented Aug 4, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Added the ability to use Instances for Nodes. useInstances can be used to enable rendering nodes using instances.
It was added as a separate flag to have the ability to improve performance, smooth and step by step, without breaking the main functionality.

The next performance improvements were made.

  • Used Instances for Sphere, Icon, Ring
  • Optimised Node Text Rendering to hide text when it is so far from the camera or display text only for visible nodes (is within sight)
  • Added the ability to override instances by using the renderInstances callback
  • Updated the accuracy of the simulation to make it faster when nodes is more than 1000
  • Instances support the next features
    • Selection
    • Selection via lasso
    • Dragging, (Single and Multiply)
    • Highlighting
    • Context Menu and Collapse/Expand feature
    • Animation

Performance comparison with 5000 nodes and 1000 edges:

Screenshot 2025-08-19 at 16 08 56

By using instances approach
Screenshot 2025-08-19 at 16 09 13

There are some thoughts about future steps for optimisation:

  • Find a way to optimise rendering of edges
  • Updates via the Zustand store aren't fast; need to think about alternative ways.
  • Using LOD (Level of details for basic components [sphere, ring, icon])

@SerhiiTsybulskyi SerhiiTsybulskyi self-assigned this Aug 4, 2025
@SerhiiTsybulskyi SerhiiTsybulskyi changed the title Instances Performance improvements (Node Instances) Aug 4, 2025
@netlify
Copy link

netlify bot commented Aug 4, 2025

Deploy Preview for reagraph ready!

Name Link
🔨 Latest commit e7ed6ce
🔍 Latest deploy log https://app.netlify.com/projects/reagraph/deploys/68a6eb262473f00008414fc6
😎 Deploy Preview https://deploy-preview-356--reagraph.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SerhiiTsybulskyi SerhiiTsybulskyi marked this pull request as ready for review August 19, 2025 13:31
Copy link
Member

@amcdnl amcdnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to spend some time to review the viability of this. Please pause on additional efforts for now.

@amcdnl amcdnl closed this Aug 25, 2025
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