Performance when first showing Diagram

4 posts, 0 answers
  1. David
    David avatar
    31 posts
    Member since:
    Jan 2013

    Posted 03 Oct Link to this post

    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

     

     

     

     

     

     

     

     

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1410 posts

    Posted 04 Oct Link to this post

    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.
  3. David
    David avatar
    31 posts
    Member since:
    Jan 2013

    Posted 04 Oct Link to this post

    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...

  4. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1410 posts

    Posted 09 Oct Link to this post

    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.
Back to Top