nforceai / rxzu

RxZu Diagrams
https://nforceai.github.io/rxzu
MIT License
3 stars 3 forks source link

Performance improvement #5

Open florianeichin opened 1 year ago

florianeichin commented 1 year ago

Hi Daniel, we are adding hundreds of custom nodes and links when loading our graphs by calling these functions:

this._diagramModel.addNodes(this._nodesToAdd);
this._diagramModel.addLinks(this._linksToAdd);

this takes 480ms for the links and 342ms for the nodes. Is there anything we can do to improve the performance on that side? I thought on something like disabling the canvas, adding everything and then enabling it again or something in that direction. Can you help out here or is it simply as it is ;-)

DanielNetzer commented 1 year ago

Hi @florianeichin, thanks for the report. Please explain how you measure the time when adding nodes/links. Also, you can aggregate all the entities into a single this.diagramModel.addAll(...models); and show a spinner till everything is painted on the graph. I will look into a solution and check why the performance is like that.

florianeichin commented 1 year ago

I measure very basic with performance.now() before and after the addNodes/Links() calls The Spinner is my Idea as well. But I thought it would be nice to come around that and simply have a blazingly fast drawing ;-) I also know the performance of your demo story, but our nodes are a lot more complex I'd say. This could also definitely be the reason ;-)

DanielNetzer commented 1 year ago

@florianeichin Good advice in terms of performance is stepping away from zone.js in general, I noticed it will improve performance for querying and painting