Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Optimize UpdateFromPoints (Read 2165 times)
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Optimize UpdateFromPoints
Jun 23rd, 2009 at 2:26pm
Print Post  
Hi Stoyan,

I want to optimize my graph loading time once again. It's getting pretty good now and my biggest bottle neck is UpdateFromPoints. Is there a way (e.g. a property somewhere I could use or a mass method) to optimize UpdateFromPoints for all my links? This is the code I use:
Code
Select All
foreach(DiagramLink link in diagram.links)
{
    UpdateBezierControlPoints(link);    // With profiler: 9 seconds
    link.UpdateFromPoints();            // With profiler: less than 1 second
} 


Do you have an idea how I can make this quicker?

Thank you,
Marie
« Last Edit: Jun 25th, 2009 at 3:23pm by marie »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Optimize UpdateFromPoints
Reply #1 - Jun 23rd, 2009 at 2:51pm
Print Post  
Hi Marie,

If you are using the LinkCrossings property, set it to LinkCrossings.Straight before loading the graph and to the value you need after that. This should work faster because UpdateFromPoints looks for links that intersect with the current one to update the arc/cut positions, and setting it in the end might avoid some unnecessary iterations of the Z order. Other than that, I can't see anything else that might be optimized there.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Optimize UpdateFromPoints
Reply #2 - Jun 23rd, 2009 at 3:07pm
Print Post  
Hi Stoyan,

LinksCrossings was set to MindFusion.Diagramming.LinkCrossings.Cut. I removed it since it wasn't working anyway with my bezier links for some reason (do you know why by the way??) and it's now faster (UpdateFromPoints now takes less than 1 second). Thanks!!!

Another question: is there another magical way to make ZTop faster? Since I want to make sure my links are in between my containers and my tableNode, I have to do this code when loading my diagram:
Code
Select All
// ZOrder up all links
foreach (DiagramLink link in this.Links)
{
    link.Style = LinkStyle.Bezier;
    link.ZTop();
}

// ZOrder up all table node (this way containers will be behind)
foreach (DiagramNode node in this.Nodes)
{
    if (node is TableNode)
        node.ZTop();
} 



Regards,
Marie
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Optimize UpdateFromPoints
Reply #3 - Jun 24th, 2009 at 6:30am
Print Post  
Hi Marie,

Calculating the intersection points of Bezier links was very slow and we disabled it.

You could sort the diagram.Items collection, which defines the actual Z order, and than call ZTop followed by ZBottom for a single container - that will trigger some code that updates the ZIndex values of the items.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: Optimize UpdateFromPoints
Reply #4 - Jun 25th, 2009 at 3:23pm
Print Post  
Hi Stoyan,

I'll try that Smiley!

Thanks a lot!
Marie
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint