LinkLayerWidget panning performance
Hello!
First of all, thanks for the awesome library, I really like this huge amount of work you've done. So far this is the best diagraming library I could found. And I totally agree with 2 layers approach (SVG + absolute positioned HTML).
The question I would like to raise here is how LinkLayerWidget performs while panning the diagram.
Take a look at this GIF

If link has bend points - it becomes "wavy" during panning.
The reasons I found for this is the following:
- LinkFactory creates new element every time it is requested. And it's requested every single panning tick.
React.cloneElementclones just created link inLinkLayerWidget.tsx:66
I fiddled with it a little bit, and here is what I tried For the first one I tried to implement link cache in my factory. It's pretty straightforward (https://gist.github.com/JokerNN/760a400189caa6facd8ae782aa1dcf11)
For the second one I have no ability to override LinkLayerWidget logic, so I removed cloning for testing purposes.
Updated result doesn't handle node dragging properly, but here how it performs:

Question 1: So can you please give me any tips/further ideas on how I can overcome this lagging and excessive cloning? Question 2: If I will succeed with optimization I'm happy to submit PR if you're accepting
Clone element is not the problem, its actually relatively fast. The problem is that the link start and end points needs to be calculated from the absolutely positioned div. These DOM calls are slow and happen as you move the canvas. I have a fix that I'm still experimenting with, but the problem you are experiencing is only when there are an excessive amount of nodes on the screen. With 20 or so nodes, its barely noticeable.
basically the problem is actually here: https://github.com/projectstorm/react-diagrams/blob/master/src/widgets/LinkLayerWidget.tsx#L44
@dylanvorster you're absolutely right, it's great that you're working on it already
Fixed! (hopefully) http://dylanv.blog/2017/09/13/storm-react-diagrams-v3/