This is a migrated thread and some comments may be shown as answers.

Performance when first showing Diagram

5 Answers 290 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
Iron
Iron
David asked on 03 Oct 2017, 06:34 PM

Hi there,

We have the following scenario:  a Diagram with 323 items and 470 links takes about 8 seconds to display the first time.  Is this reasonable and expected?  What should we be looking at to improve this load time, please?

We do intend to show the entirety of the Diagram with all items and links at once, so we can't take advantage of Virtualization.

Profiling results indicate that the largest chunk of time is indeed spent in the Diagram constructor.

A large chuck of time is spent in RadDiagram.UpdateStylesAndTemplates, which is called three times (I suspect for the setting of each of ShapeStyle, ContainerShapeStyle, and ConnectionStyle) and seems to do plenty of work each time.  I think this says that we already have the GraphSource populated before we hit the definitions of those styles (this is true based on reading order of the xaml).

What other sorts of things could we look at? 

 

Thanks,

-David

 

 

 

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 04 Oct 2017, 07:44 AM
Hello David,

The diagram has a built-in UI virtualization, but it's implementation kicks-in only after the diagram is loaded initially. The slow loading time comes from the fact that the diagram creates the containers for all the shapes initially. So, in summary it is expected for the diagram to be slow at first start. 

In order to improve the initial load time you can implement some data virtualization that loads only the shapes that should be visible in the viewport. Then load the rest on demand. For example, when the diagram loads empty you can get its viewport, via the Viewport property. Then you can load only the shapes which positions are inside the viewport rectangle. You can load the rest of the shapes when the viewport changes. Or if you prefer you can start a timer and load shapes on portions. 

I hope this suggestion helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
David
Top achievements
Rank 1
Iron
Iron
answered on 04 Oct 2017, 03:03 PM

Turns out we can't take advantage of virtualization -- we are indeed trying to show the whole diagram at once.

I did reorder the xaml so that we set GraphSource after setting ShapeStyle, ContainerShapeStyle and ConnectionStyle.  That gets us down to about 6 seconds of load time from 8.

We'd still like to do more if you all have other suggestions, please...

0
Martin Ivanov
Telerik team
answered on 09 Oct 2017, 09:38 AM
Hello David,

Here are some additional tips which you can try.
Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Torsten
Top achievements
Rank 1
answered on 26 Oct 2017, 02:59 PM

Hello Martin,

we are looking for a diagram-Control for our new desktop-app. we tested your diagramcontrol and have the same problem as David. We try to visualize a diagram with up to 5000 items (worst case). Most of the items are simple lines, so we tried to optimize our testproject with the given tips. But they didn't help much. I replaced the default template of the RadDiagramShapeBase with a simple <border> to have the visual tree as slim as possible. When I now generate a diagram with 5000 random Items (MVVM), it takes up to 13 seconds until the diagram is shown. Then I realised that setting the initial WindowState of the window from Normal to Maximized reduces the time to 3 seconds!

Because of this, I think there is some kind of bug in your engine, which slows everything down.

I couldn't attach a Testproject. Is there some way to attach one for you?

We also tested Infragistics. Their control is a lot faster, even with a more complex visual tree. We still have some time for testing. If you could manage to improve the Performance, we would like to use your controls. Otherwise we will go with Infragistics.

 

Thanks,

Torsten

 

0
Petar Mladenov
Telerik team
answered on 31 Oct 2017, 02:18 PM
Hi Torsten,

You can open a new support thread from your account where you will be able attach files and you will take advantage of guaranteed 24-hours response time from us.
Generally you can give us a saved XML from your diagram (unless you have custom types in it) and we will try to test it locally and improve the overall performance.
What you can now check fast is turning off the default virtualization telerik:DiagramSurface.IsVirtualizing="False". We are aware of some issues in the virtualization engine and we have logged a related item in our feedback portal:

Diagram: Improve virtualization performance

Regards,
Petar Mladenov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Diagram
Asked by
David
Top achievements
Rank 1
Iron
Iron
Answers by
Martin Ivanov
Telerik team
David
Top achievements
Rank 1
Iron
Iron
Torsten
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or