Large diagram dimensions having serious performance impact

I have recently run into some serious performance issues (whole page freezes for a minute or two before blowing the call stack). After getting the diagram to render following this, I noticed the nodes were incredibly far apart on our diagram. This is something I reckon we can mitigate on our side of course, nevertheless its rather concerning that GoJS would blow the stack in the first place. The diagram in question uses simple templates, fewer than 100 nodes in the model, and this issue exists even with links being omitted.

I realize the information provided is scanty at best, but I’m trying to find out if there are any known issues that might be related to this, I did some searching but haven’t found anything resembling this particular scenario.

Thanks in advance for any tips.

What Diagram.layout are you using? I’m guessing you are using ForceDirectedLayout. Normally there shouldn’t be any problems, but I have occasionally seen cases where the nodes would be placed unusually far from each other. Perhaps you have very long simple chains of nodes?

Hey Walter, thanks for the prompt response!

We are using an extended version of the LayeredDigraphLayout (from V1.8 in this case).

Looking at the stack trace, this is the offending function (from go-debug.js):
image
(if the image doesn’t upload search for “if (1 <= p && 999999 > p)”)

To be clear our code has specified the absurd coordinates, I simply don’t believe this should result in any significant performance impact, particularly considering the low complexity of the diagram. We cannot control what our users do, and indeed I don’t think we should restrict users from doing such things.

I understand our layout extension could be the culprit, however given the (oddly) obscured nature of your debug build I am not sure of the best way to narrow down my search at the moment.

In the meantime I’ll see if I can duplicate the issue using a standard demo.

I think that’s because you have Link.routing set to go.Link.AvoidsNodes, and for some reason the normal optimizations are not effective when determining a very long link’s route.

First, you can confirm that by setting Link.routing to go.Link.Orthogonal.

Second, I’m surprised that LayeredDigraphLayout could produce such a large (in area) diagram. Certainly not with just 100 or so nodes. Unless each node is huge in at least one dimension…

Third, if you are using LayeredDigraphLayout (or TreeLayout) you don’t need to have AvoidsNodes routing – the layout will route Orthogonal links to avoid nodes.

Fourth, if you are using AvoidsNodes routing just to handle the case that the user moves a node, you could implement a “SelectionMoved” DiagramEvent listener that turned on AvoidsNodes routing on all of the links connected with moved nodes.

Thanks Walter you were exactly right. Changing from AvoidsNodes allows the diagram to render successfully and with great performance. I should have known, somehow I thought we had disabled links and still experienced the issue, my bad.

This lets me move forward, thank you so much!