Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Grid slow? (Read 11172 times)
Kurt
YaBB Newbies
*
Offline


48°32'N 8°1'E

Posts: 10
Location: Germany
Joined: Oct 24th, 2005
Grid slow?
Jan 31st, 2006 at 8:56am
Print Post  
I fancy, that the grid is drawn more slowly since version 4, especially when the Gridsize is small. There's also a delay, when you select a ChartObject and the grid is shown.
  
Back to top
WWW  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #1 - Jan 31st, 2006 at 9:43am
Print Post  
The grid has always been drawn slowly with a small grid size, we haven't changed anything related to the grid in version 4. If you have recently moved to .NET 2, probably the SetPixel method is slower in the .NET 2 Graphics class? Or have you changed the size of the flowchart, if it is now larger - there could be much more calls to SetPixel to make ?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #2 - Jan 31st, 2006 at 7:44pm
Print Post  
We have optimized this a bit, now the grid is drawn a little faster but some precision in the calculations is lost and the points seem offset with 1 pixel here and there. You can try the updated dll here:

https://mindfusion.org/_temp/gridtest.zip

We'll see if we can improve the precision without losing the speed gain.
  
Back to top
 
IP Logged
 
Kurt
YaBB Newbies
*
Offline


48°32'N 8°1'E

Posts: 10
Location: Germany
Joined: Oct 24th, 2005
Re: Grid slow?
Reply #3 - Feb 1st, 2006 at 8:04am
Print Post  
Yes, with the new dll's it seem to be faster.

But there's another speed problem. FlowChart.Net is generally slower since version 4.01.
As an example I tested the command "CreateControlHost". In version 4.00 it lasts about 170 ms to create 10 ControlHost, every controlhost is create in about 15 ms.
In 4.01, 4.02 (and the yesterday's dlls) 10 controlhosts are created in about 800 ms.
When I have 50 ControlHosts on a Flowchart, this is a significant difference.
  
Back to top
WWW  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #4 - Feb 1st, 2006 at 8:23am
Print Post  
There aren't that many changes in version 4.0.1 that could affect the overall speed of the control. Are you sure you haven't changed some properties around the time you started to use the new version ? For example, enabling RouteArrows could affect item creation time a lot, because when a node is created, the arrows near it are re-routed. Or the controls you host in ControlHost nodes might require more time to create now ?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #5 - Feb 1st, 2006 at 8:26am
Print Post  
Or have you started using .NET 2 / VS2005 with version 4.0.1 of the control? The time needed to create .NET controls (hosted in the ControlHosts) might have increased in .NET 2.
  
Back to top
 
IP Logged
 
Kurt
YaBB Newbies
*
Offline


48°32'N 8°1'E

Posts: 10
Location: Germany
Joined: Oct 24th, 2005
Re: Grid slow?
Reply #6 - Feb 1st, 2006 at 9:38am
Print Post  
I did these tests all today, i.e. without change in code (except GridSize <-> GridSizeX/Y). I deinstalled and installed the respective FlowChart version, I tested every version about three times and I could reproduce the results.

By the way I use VS 2005.
  
Back to top
WWW  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #7 - Feb 1st, 2006 at 10:09am
Print Post  
I have checked the SourceSafe history for the Flowchart.net project, the only recent change related to ControlHost nodes is that now shadows are painted for them. I don't think that would slow down ControlHost creation that much.

We will run some tests with both versions and I will let you know if we find what the problem might be.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #8 - Feb 1st, 2006 at 10:22am
Print Post  
By the way, that last 'gridtest' dll was built for .NET 1.1. If you use it in a .NET 2 application, it will load both versions of the .NET runtime, which could slow things a little.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #9 - Feb 1st, 2006 at 11:05am
Print Post  
We've run this test with the 4.0.0 version, it took 4326 milliseconds to complete:

private void button1_Click(object sender, EventArgs e)
{
  fc.ValidityChecks = false;
  fc.DefaultControlType = typeof(Button);
  fc.SuspendLayout();

  DateTime start = DateTime.Now;
  for (int i = 0; i < 500; ++i)
  {
    fc.CreateControlHost((i % 10) * 40, (i / 10) * 40, 30, 30);
  }
  DateTime end = DateTime.Now;

  TimeSpan ellapsed = end - start;
  MessageBox.Show(ellapsed.TotalMilliseconds.ToString());
 
  fc.ResumeLayout();
  fc.FitDocToObjects(0);

}

Now we'll test that with the 4.0.2 version.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #10 - Feb 1st, 2006 at 11:20am
Print Post  
It took 4085 milliseconds with FlowChart.NET 4.0.2, so the new version is actually faster than the old one.

What controls do you use with the ControlHost nodes, are they from the .NET class library or your custom ones ?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #11 - Feb 1st, 2006 at 12:11pm
Print Post  
A new feature in the 4.0.1 version - "Now the scrollbars are hidden if they are not needed" - actually overrides the Control.OnLayout method to compare the visible area with the document size. That should not add that much overhead; still you can prevent the calculations being done after each control is added by using the SuspendLayout/ResumeLayout methods. OnLayout is called after a child control is added to another control, so that could slow a bit the CreateControlHost method.
  
Back to top
 
IP Logged
 
Kurt
YaBB Newbies
*
Offline


48°32'N 8°1'E

Posts: 10
Location: Germany
Joined: Oct 24th, 2005
Re: Grid slow?
Reply #12 - Feb 1st, 2006 at 12:44pm
Print Post  
I have tested your code and I have got nearly the same results like yours.

The only difference between your and my test was the "SuspendLayout" and "ResumeLayout". With this commands it works fine, even much faster than in 4.0.0!

Thank you very much for your efforts Roll Eyes
  
Back to top
WWW  
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Grid slow?
Reply #13 - Feb 1st, 2006 at 12:59pm
Print Post  
That's great 8) Ok, we have probably found a good tip here, I will pass it to Iva so she documents it in next version's help file.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint