Performance on pan

13 posts, 0 answers
  1. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 29 Apr 2015 Link to this post

    I'm trying to figure out how to deal with terribly poor performances of my application during pan operations.

    Basically when the user starts panning a diagram the CPU goes 100%. Things seems getting worse when the navigation pane is visible.

     

    Profiling the application, it seems that the issue is caused by RadDiagram calling the BackgroundLineBase.PrepareLine method thousand times.

    Strangely enough I've managed to reproduce the issue in this project from your sample codebase:

    • open the application
    • drag some shapes on the diagram 
    • start panning (at least a second or two)
    •  => the CPU goes 100%​

     

     Can you provide some advice on how to mitigate / fix the issue?

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 30 Apr 2015 Link to this post

    Hello Manuel,

    We were unable to reproduce CPU usage up to 100% with the provided steps. For better investigation we can suggest the following tips:

    -- You can send us a captured video of how exactly you test the Docking Integration demo. What is the telerik version you use ?
    -- do you use touch device ? If yes, you can try disabling our automation peers which are invoked many times on touch devices and could possibly slow down the performance. 
    public mainWindow()
           {
               AutomationManager.AutomationMode = AutomationMode.Disabled;
               InitializeComponent();
           }

    -- if you don't need background grid or snapping you can switch them off. Set IsSnapToItemsEnabled = False and IsSnapToGridEnabled = False, IsBackgroundSurfaceVisible= False.

    -- The Thumbnail could be manually refreshed with Refresh() method if you set IsAutoRefreshEnabled = False. In terms of NavigationPane, you can set properties to the underlying Thumbnail via ThumbnailStyle property and refresh it via RefreshThumbnail() property.


    Regards,
    Petar Mladenov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 30 Apr 2015 in reply to Petar Mladenov Link to this post

    Here you can find a 30 sec video reproducing the issue: with no performance profiler attached (just Sysinternals Process Explorer, to demonstrate the CPU consumption) on my PC you can immediately see a "lag" while dragging.

    The video has been recorded on a Windows 8.1 machine with 8 GB RAM and Intel i7 CPU.

     

    I'll try your proposed optimizations and I'll let you know.

    Thank you for your help.

  5. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 30 Apr 2015 in reply to Manuel Link to this post

    I've tried the following, but unfortunately none of them helped reducing the CPU consumption:

    • Remove the RadDiagramNavigationPane
    • Disable snapping and background surface visibility
    • Disable automation peers
    • Disable zoom and pan animations (DiagramAnimations.IsZoomAnimationEnabled="False" and DiagramAnimations.IsPanAnimationEnabled="False")

    any ideas?​

  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 May 2015 Link to this post

    Hello Manuel,

    We manage to reach 45-47 percent CPU usage with the steps you perform in your video and the latest version of RadDiagram. However, this is strongly specific for the machine and the operation system.
    However, a way to improve the overall performance on pan that we missed to suggest is disabling the DiagramRulers. You can consider a delayed refresh on them when the pan is finished.
    Also we wanted to know what is your exact telerik UI version, is it the latest on ?

    Regards,
    Petar Mladenov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  7. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 04 May 2015 in reply to Petar Mladenov Link to this post

    You are right: I forgot to mention I'm on .NET 4.0 and RadControls 2015.1.225.40.

    Of course the CPU consumption depends on the machine, imagine what's happening to my users: every time they pan a graph the entire machine is terribly slow down... :(

    My application doesn't make use of rulers so unfortunately your latest advice won't help...

  8. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 04 May 2015 Link to this post

    Hi Manuel,

    Could you please share the settings in Diagram you use and how is the diagram hosted ? This would help us advice you better on how you can improve the performance. You can send us an isolation in a separate support thread.
    In our JustTrace profiler we haven't yet reproduced a performance bottleneck in BackgroundLineBase.PrepareLine. Can you confirm this is still an issue if you disable the bckground grids and Snappings ?

    Regards,
    Petar Mladenov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  9. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 04 May 2015 in reply to Petar Mladenov Link to this post

    These are my settings, they are not too different from your demo code I think:

     

    <diagram1:DfmDiagram
        IsRotationEnabled="False"
        IsResizingEnabled="False"
        AllowDrop="True"
        SelectionMode="Extended"
        GraphSource="{Binding FactSchema}"
        telerik:DiagramAnimations.IsZoomAnimationEnabled="False">

     

    Here you can find a performance profiling session of my application. Looking at the RadDiagram.OnMouseMove method call (see also the attached screenshot, Hit Count 114) I've found that it internally calls BackgroundGridBase.PrepareLine thousand times (Hit Count 7592). 

    Am I missing something else?

  10. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 May 2015 Link to this post

    Hi Manuel,

    The code snippet and the stack trace from the profiler show that you are using BackgroundGrids.
    Could you please confirm setting IsBackgroundSurfaceVisible = False improves the performance ? Do you need this feature ?
    On a side note you can turn off the PanAnimation as well  - telerik:DiagramAnimations.IsPanAnimationEnable = False.

    Regards,
    Petar Mladenov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  11. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 05 May 2015 in reply to Petar Mladenov Link to this post

    Background surface visibility is a user setting in my application, probably I've profiled the application with background turned on.

    Here a recap of my attempts:

    • Remove the RadDiagramNavigationPane
    • Disable snapping and background surface visibility
    • Disable automation peers
    • Disable zoom and pan animations (DiagramAnimations.IsZoomAnimationEnabled="False" and DiagramAnimations.IsPanAnimationEnabled="False")

    As you can try on your demo code, none really helped: a simple pan is still terribly expensive.​

  12. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 06 May 2015 Link to this post

    Hi Manuel,

    We tested and profiled our docking integration demo with the mentioned settings (plus removed DiagramRulers). The results show no performance issues while we pan the Diagram - please check the captured video. Is it possible to profile this demo with these settings at your side too and let us know if you experience difference results in JustTrace / Ants ?

    Regards,
    Petar Mladenov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  13. Manuel
    Manuel avatar
    32 posts
    Member since:
    Sep 2013

    Posted 12 May 2015 in reply to Petar Mladenov Link to this post

    Hi Petar,

    I've applied all your suggestions on the sample application. It surely performs better: approx 50% off in CPU usage.

    Unfortunately, performances are still really poor on a low-end machine.

  14. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 May 2015 Link to this post

    Hi Manuel,

    After the performance improvement of 50%, do you notice bottlenecks when you profile the application with Ants / JustTrace ? Generally the translation (applying TranslationTransform) on big number of objects might be slow in WPF on slow machines. You can try the panning in RadMap with many shapes over it or isolate sample with translate transform applied on 50-100 objects.

    Regards,
    Petar Mladenov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready