lempiy / flutter_graphite

Flutter widget to draw interactive direct graphs (flowcharts) of any complexity in a tile rectangular manner.
MIT License
166 stars 32 forks source link

Large complex list poor performance #25

Closed jrheisler closed 1 year ago

jrheisler commented 1 year ago

I have been testing size and complexity with Graphite. It's very performant up to a certain point, and it depends on the complexity of the edge connections. Have you run into any stress testing limits?

lempiy commented 1 year ago

I think the issue relates to redunant calls of algorithm on each widget rebuild and redunant CustomPainter repaints. Probably, even simple memoization of algorithm call may help. I'll look into it.

How many nodes/edges did you test ?

jrheisler commented 1 year ago

It gets weird when there are around 100 nodes and 120 edges. It could be the complexity too though.

jrheisler commented 1 year ago

It will stall during creation for 10 + seconds. Back off a little and it does great.

lempiy commented 1 year ago

I was doing some flame graphs and looks like the main problem is Widgets amount - it forces rendering to underperform. I think we would need GridView.builder-like optimisation with conditional rendering for a big lists.

Also I found my List.fold to detect matrix width "on a fly" to have poor performance on my Android. I will get rid of it. Still, I can't reproduce such a huge lags (10+ sec) with my randomly generated graph with 100 nodes and 150 edges. Perhaps, it's not deep enough to cause performance issues.

Is it possible to get input you're using for your app as json or csv file? Also what OS are you using?

jrheisler commented 1 year ago

I am using Flutter web. If you really need json or csv I can see what I can do. This is an image of it:

https://drive.google.com/file/d/1YcZcxZfR6AMV7eICk8Je1IBD2apFsvht/view?usp=sharing

Btw, I have changed to only create the nodes conditionally. I have a simple tree view along side it and when the tree would be over 50 nodes, I only open the top level, a handful of nodes, and they can reveal the rest by opening the tree:

https://drive.google.com/file/d/15C7AR_k22DorbXtiDCVhAAtZMGReGrBg/view?usp=sharing

jrheisler commented 1 year ago

These are all of the nodes:

1 1.001 1.001.001 1.001.001.001 1.001.001.001.001 1.001.001.001.002 1.001.001.001.003 1.001.001.002 1.001.001.002.001 1.001.001.002.002 1.001.001.002.003 1.001.001.002.004 1.001.001.003 1.001.001.003.001 1.001.001.003.002 1.001.001.003.003 1.001.001.004 1.001.001.004.001 1.001.001.004.002 1.001.001.004.003 1.001.002 1.001.002.001 1.001.002.001.001 1.001.002.001.002 1.001.002.002 1.001.002.002.001 1.001.002.002.002 1.001.002.002.003 1.001.002.002.004 1.001.002.003 1.001.002.003.001 1.001.002.003.002 1.001.002.004 1.001.002.004.001 1.001.002.004.002 1.001.002.004.003 1.001.002.004.004 1.001.002.004.005 1.001.002.005 1.001.002.005.001 1.001.002.005.002 1.001.002.005.003 1.001.002.005.004 1.001.003 1.001.003.001 1.001.003.001.001 1.001.003.001.002 1.001.003.001.003 1.001.003.001.004 1.001.003.001.005 1.001.003.001.006 1.001.003.002 1.001.003.002.001 1.001.003.002.002 1.001.003.002.003 1.001.003.002.004 1.001.003.002.005 1.001.004 1.001.004.001 1.001.004.001.001 1.001.004.001.002 1.001.004.001.003 1.001.004.001.004 1.001.004.001.005 1.001.004.001.006 1.001.004.001.007 1.001.004.002 1.001.004.002.001 1.001.004.002.002 1.001.004.002.003 1.001.004.002.004 1.001.004.003 1.001.004.003.001 1.001.004.003.002 1.001.004.003.003 1.001.004.003.004 1.001.004.003.005 1.001.004.003.006 1.001.004.003.007 1.001.004.004 1.001.004.004.001 1.001.004.004.002 1.001.004.004.003 1.001.004.004.004 1.001.005 1.001.005.001 1.001.005.001.001 1.001.005.001.002 1.001.005.002 1.001.005.002.001 1.001.005.002.002 1.001.005.002.003 1.001.005.002.004 1.001.005.003 1.001.005.003.001 1.001.005.003.002 1.001.005.003.003 1.001.005.003.004 1.002

This is how the arrows go:

1 - 1.001 1.001 - 1.002 1.001 - 1.001.001 1.001.001 - 1.001.002 1.001.001 - 1.001.001.001 1.001.001.001 - 1.001.001.002 1.001.001.001 - 1.001.001.001.001 1.001.001.001.001 - 1.001.001.001.002 1.001.001.001.002 - 1.001.001.001.003 1.001.001.001.003 - 1.001.001.002 1.001.001.002 - 1.001.001.003 1.001.001.002 - 1.001.001.002.001 1.001.001.002.001 - 1.001.001.002.002 1.001.001.002.002 - 1.001.001.002.003 1.001.001.002.003 - 1.001.001.002.004 1.001.001.002.004 - 1.001.001.003 1.001.001.003 - 1.001.001.004 1.001.001.003 - 1.001.001.003.001 1.001.001.003.001 - 1.001.001.003.002 1.001.001.003.002 - 1.001.001.003.003 1.001.001.003.003 - 1.001.001.004 1.001.001.004 - 1.001.002 1.001.001.004 - 1.001.001.004.001 1.001.001.004.001 - 1.001.001.004.002 1.001.001.004.002 - 1.001.001.004.003 1.001.001.004.003 - 1.001.002 1.001.002 - 1.001.003 1.001.002 - 1.001.002.001 1.001.002.001 - 1.001.002.002 1.001.002.001 - 1.001.002.001.001 1.001.002.001.001 - 1.001.002.001.002 1.001.002.001.002 - 1.001.002.002 1.001.002.002 - 1.001.002.003 1.001.002.002 - 1.001.002.002.001 1.001.002.002.001 - 1.001.002.002.002 1.001.002.002.002 - 1.001.002.002.003 1.001.002.002.003 - 1.001.002.002.004 1.001.002.002.004 - 1.001.002.003 1.001.002.003 - 1.001.002.004 1.001.002.003 - 1.001.002.003.001 1.001.002.003.001 - 1.001.002.003.002 1.001.002.003.002 - 1.001.002.004 1.001.002.004 - 1.001.002.005 1.001.002.004 - 1.001.002.004.001 1.001.002.004.001 - 1.001.002.004.002 1.001.002.004.002 - 1.001.002.004.003 1.001.002.004.003 - 1.001.002.004.004 1.001.002.004.004 - 1.001.002.004.005 1.001.002.004.005 - 1.001.002.005 1.001.002.005 - 1.001.003 1.001.002.005 - 1.001.002.005.001 1.001.002.005.001 - 1.001.002.005.002 1.001.002.005.002 - 1.001.002.005.003 1.001.002.005.003 - 1.001.002.005.004 1.001.002.005.004 - 1.001.003 1.001.003 - 1.001.004 1.001.003 - 1.001.003.001 1.001.003.001 - 1.001.003.002 1.001.003.001 - 1.001.003.001.001 1.001.003.001.001 - 1.001.003.001.002 1.001.003.001.002 - 1.001.003.001.003 1.001.003.001.003 - 1.001.003.001.004 1.001.003.001.004 - 1.001.003.001.005 1.001.003.001.005 - 1.001.003.001.006 1.001.003.001.006 - 1.001.003.002 1.001.003.002 - 1.001.004 1.001.003.002 - 1.001.003.002.001 1.001.003.002.001 - 1.001.003.002.002 1.001.003.002.002 - 1.001.003.002.003 1.001.003.002.003 - 1.001.003.002.004 1.001.003.002.004 - 1.001.003.002.005 1.001.003.002.005 - 1.001.004 1.001.004 - 1.001.005 1.001.004 - 1.001.004.001 1.001.004.001 - 1.001.004.002 1.001.004.001 - 1.001.004.001.001 1.001.004.001.001 - 1.001.004.001.002 1.001.004.001.002 - 1.001.004.001.003 1.001.004.001.003 - 1.001.004.001.004 1.001.004.001.004 - 1.001.004.001.005 1.001.004.001.005 - 1.001.004.001.006 1.001.004.001.006 - 1.001.004.001.007 1.001.004.001.007 - 1.001.004.002 1.001.004.002 - 1.001.004.003 1.001.004.002 - 1.001.004.002.001 1.001.004.002.001 - 1.001.004.002.002 1.001.004.002.002 - 1.001.004.002.003 1.001.004.002.003 - 1.001.004.002.004 1.001.004.002.004 - 1.001.004.003 1.001.004.003 - 1.001.004.004 1.001.004.003 - 1.001.004.003.001 1.001.004.003.001 - 1.001.004.003.002 1.001.004.003.002 - 1.001.004.003.003 1.001.004.003.003 - 1.001.004.003.004 1.001.004.003.004 - 1.001.004.003.005 1.001.004.003.005 - 1.001.004.003.006 1.001.004.003.006 - 1.001.004.003.007 1.001.004.003.007 - 1.001.004.004 1.001.004.004 - 1.001.005 1.001.004.004 - 1.001.004.004.001 1.001.004.004.001 - 1.001.004.004.002 1.001.004.004.002 - 1.001.004.004.003 1.001.004.004.003 - 1.001.004.004.004 1.001.004.004.004 - 1.001.005 1.001.005 - 1.001.005.001 1.001.005.001 - 1.001.005.002 1.001.005.001 - 1.001.005.001.001 1.001.005.001.001 - 1.001.005.001.002 1.001.005.001.002 - 1.001.005.002 1.001.005.002 - 1.001.005.003 1.001.005.002 - 1.001.005.002.001 1.001.005.002.001 - 1.001.005.002.002 1.001.005.002.002 - 1.001.005.002.003 1.001.005.002.003 - 1.001.005.002.004 1.001.005.002.004 - 1.001.005.003 1.001.005.003 - 1.001.005.003.001 1.001.005.003.001 - 1.001.005.003.002 1.001.005.003.002 - 1.001.005.003.003 1.001.005.003.003 - 1.001.005.003.004

lempiy commented 1 year ago

I released a fix, update version to 1.1.2 and recheck.

jrheisler commented 1 year ago

Fantastic, it's fast as ever. Thank you so much!!!