Improving performance for high frequency updates

Posted by: phillip.gan on 1 March 2019, 3:53 am EST

  • Posted 1 March 2019, 3:53 am EST

    I have a datagrid that is sorted such that new items and recently updated items appear at the top of the grid. Items are added/updated around 100 times per second. It's an orders blotter.

    Can you please advise if there is an optimal configuration for the C1DataGrid for this scenario? I am trying to find an alternative to the standard WPF DataGrid but simply swapping for a C1DataGrid has reduced processing speed by around half.
  • Replied 3 March 2019, 10:47 pm EST

    Hi,

    I would not be able to comment much without seeing the structure of the application. But generally, C1DataGrid offers better performance than the MS-DataGrid. So, it would be better if you can share with me a stripped application that shows your issue.

    Meanwhile, you may refer to 'DataGridSamples'->'Performance/'DeferredScrolling' product sample (installed at \Documents\ComponentOne Samples\WPF\C1.WPF.DataGrid\CS) to have a look at optimal configurations that gives better application performance.

    Also, if you have just started with replacing the standard datagrid, you may also use our FlagShip FlexGrid control. C1FlexGrid also offers Rows's DeferNotifications method that would suspend any notifications and is used to perform batch updates efficiently. This should improve your application's performance.

    Thanks,
    Ruchir
  • Replied 4 March 2019, 2:01 am EST

    Hi Ruchir,

    Thanks for the advice. So for the grid I have it declared like this:

    <c1:C1FlexGrid x:Name="ExchageOrdersDataGrid"
    Margin="3"
    ItemsSource="{Binding ItemsSource,ElementName=this}"
    IsReadOnly="True"
    AllowSorting="True"
    Loaded="ExchageOrdersDataGrid_OnLoaded"
    AllowResizing="Columns">


    And in the code behind I have this:

    private IDisposable defer;

    private void ExchageOrdersDataGrid_OnLoaded(object sender, RoutedEventArgs e)
    {
    defer = ExchageOrdersDataGrid.Rows.DeferNotifications();
    }


    As I understand this should prevent the flexgrid from showing new rows? But it doesn't seem to work, can you advise please?
  • Marked as Answer

    Replied 6 March 2019, 5:08 am EST

    Hi,

    Apologies for delay in response.
    DeferNotifications method suspends notifications until a IDisposable object is returned. So, the appropriate way to use this method is as follows:
    var rows = _flexGrids.Rows;
    using (rows.DeferNotifications())
    {
    foreach (var gr in rows.OfType<GroupRow>())
    {
    //perform row operations here
    gr.IsCollapsed = gr.Level >= level;
    }
    }
    Let me know if it does not make an impact.

    Thanks,
    Ruchir
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels