vasturiano/force-graph

Performance issue on 8k+ nodes

Closed this issue · 4 comments

moda20 commented

Hello, i am building a graph with 8k nodes using this library and contrary to the 75k elements example i am getting a huge performance issue in form of lag when zooming or panning the graph.
I do use : custom node canvas drawing and text on links. Could this be an issue with the multiple refreshes of each node image each second ?

i tried the config elements but to no use :

.d3AlphaDecay(0)
.d3VelocityDecay(0.08)
.cooldownTime(60000)

@moda20 if your code performs well without the custom node/link drawing methods, you'll know that there is something in there that's causing the frame-rate drop. I'd suggest to go line by line until you come across the instruction that causes the most performance degradation. And then focus on optimizing that operation.

moda20 commented

@vasturiano the issue was with the link text painting (done via : linkCanvasObject) being done many times per second for multiple links. IS there a way to know which links are completely visible, i.e. the user has zoomed on them, so that i can decide which custom link text to show

@moda20 you should be able to determine it by reading the link's coordinates, as well as the current frame of view using .zoom() and .centerAt().

moda20 commented

@vasturiano thanks i am closing this issue