Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram SVG export slowdown in never version. (Read 451 times)
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Diagram SVG export slowdown in never version.
Nov 11th, 2024 at 6:54am
Print Post  
Hello MindFusion team!
I would like to report that performance has dramatically worsened when we export diagram to SVG in 4. major version of the library. I've attached Import button to two diagrams in different versions of the library, and added Stopwatch where. As I found out, exporting time has increased at least thrice, and it is really crucial for our app to export diagrams faster. Is there a workaround for this?
  

MindfusionNewVersionIssues.zip ( 438 KB | 34 Downloads )
MindfusionIssues.zip ( 437 KB | 35 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Diagram SVG export slowdown in never version.
Reply #1 - Nov 11th, 2024 at 3:34pm
Print Post  
Hi,

Version 3 was converting an already-rendered WPF visual tree to SVG, while new one does not have the full tree due to virtualization, and first renders whole diagram in an off-screen presenter before converting.

We guess with the property for disabling virtualization our developer added for previous thread of yours (you never confirmed if that works for you?), we could also add an Export overload that takes a DiagramView and converts its already-rendered visual tree again. We'll try to implement that for upcoming release.

Regards,
Slavcho
Mindfusion

  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Re: Diagram SVG export slowdown in never version.
Reply #2 - Nov 12th, 2024 at 5:55am
Print Post  
I've confirmed that EnableVirtualization property was covering the case in that topic, thanks. Basically if I am okay with the solution you provide, I don't reply, but now I will, so you can confirm that you resolve my issues Smiley
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Diagram SVG export slowdown in never version.
Reply #3 - Nov 13th, 2024 at 1:19pm
Print Post  
try new Export(DiagramView) overload here -

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.1.4-rc5

It only processes view's current visual tree, so you must also disable virtualization in order to export nodes that are outside of the viewport.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Re: Diagram SVG export slowdown in never version.
Reply #4 - Nov 25th, 2024 at 11:35am
Print Post  
Hello, this fix works, thank you.
I would also like to mention performance slowdown when comparing these two demos in terms of opening the app window. If you check it on older version, you mention that app window opens just after the user code in MainWindow() constructor ends. But if you check it on newer version, then you see that app window will open only after a couple of seconds after the user code. Time difference between execution of the user code is negligible and virtualization is disabled. I want to know if we can fix that slowdown as well.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Diagram SVG export slowdown in never version.
Reply #5 - Nov 26th, 2024 at 6:41am
Print Post  
Hi,

We guess that's the time it takes to create presenters for the 11400 nodes and arrange them when you disable virtualization, or when all nodes are visible in current viewport. Our developer will research if there's anything we can do to speed up the process.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Diagram SVG export slowdown in never version.
Reply #6 - Dec 4th, 2024 at 12:25pm
Print Post  
Try setting this flag before populating diagram:

Code
Select All
DevFlags.LightweightPresenters = true; 



using new build here:

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.1.4-rc7

ControlNodes and custom node templates will not work in this mode just yet, and we'd generally need to test everything else before adding an official property for that.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
nullable
Full Member
***
Offline


I Love MindFusion!

Posts: 114
Joined: Aug 25th, 2022
Re: Diagram SVG export slowdown in never version.
Reply #7 - Dec 5th, 2024 at 9:39am
Print Post  
This property works perfectly, thank you!
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3321
Joined: Oct 19th, 2005
Re: Diagram SVG export slowdown in never version.
Reply #8 - Dec 27th, 2024 at 12:37pm
Print Post  
A heads-up we are making this an official DiagramView per-instance property here:

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.1.6-beta1

Code
Select All
diagramView.LightweightPresenters = true;
 



This also restores a few bindings that were not set with previous flag implementation. Apparently configuring WPF data bindings is not very fast and adds a couple of seconds to your 11400 nodes scenario. You can avoid that by setting a new flag now:

Code
Select All
DevFlags.SetLightweightPresenterBindings = false;
 



Most notable missing bindings would be for Opacity and ContextMenu properties of DiagramItem. You could work around the former by setting a semitransparent Brush value instead, and around the latter by showing ContextMenu instance from NodeClicked event handler.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint