)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to improve the performance of WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: November 13, 2015 |
Last Revised Date: December 31, 2019

Performance of GridGroupingControl

The performance of GridGroupingControl can be improved by making use of the below optimization encryptions in the sample application.

C#

// Optimizing the grid for better performance
void OptimizeGridSettings(GridGroupingControl gridGroupingControl1)
{
    gridGroupingControl1.CounterLogic = EngineCounters.YAmount;
    gridGroupingControl1.AllowedOptimizations = EngineOptimizations.DisableCounters |    EngineOptimizations.RecordsAsDisplayElements;
    // GDI interop drawing, FirstNRecords Summaries.
    gridGroupingControl1.UseDefaultsForFasterDrawing = true;
    // Only paint modified cells.
    gridGroupingControl1.InvalidateAllWhenListChanged = false; 
    gridGroupingControl1.InsertRemoveBehavior = GridListChangedInsertRemoveBehavior.InvalidateAll;
}

 

VB

' Optimizing the grid for better performance
Private Sub OptimizeGridSettings(GridGroupingControl As gridGroupingControl1)
     gridGroupingControl1.CounterLogic = EngineCounters.YAmount
     gridGroupingControl1.AllowedOptimizations = EngineOptimizations.DisableCounters | EngineOptimizations.RecordsAsDisplayElements
     ' GDI interop drawing, FirstNRecords Summaries.
     gridGroupingControl1.UseDefaultsForFasterDrawing = True
     ' Only paint modified cells.
     gridGroupingControl1.InvalidateAllWhenListChanged = False
     gridGroupingControl1.InsertRemoveBehavior = GridListChangedInsertRemoveBehavior.InvalidateAll
End Sub

 

Optimizing memory performance

AllowedOptimizations - Specifies the optimizations, the engine is allowed to use when applicable. These optimizations can be used in combination with EngineCounter setting. EngineOptimizations enum defines values for this property.

CounterLogic - It specifies the CounterLogic to be used within the engine. GroupingEngine maintains counters for VisibleColumns, FilteredRecords, YAmount, HiddenRecords, and the like. These counters occupy a countable portion of the grid tree in memory. On every list change, all these counters need to be refreshed along with the data records.

UseDefaultsForFasterDrawing - By setting this to true, you can quickly switch to faster GDI Draw Text, Solid Borders and more efficient calculation of the optimal width of a column. Initializes recommended settings to improve handling of ListChanged events and scrolling through grid. Affected settings are: TableOptions.ColumnsMaxLengthStrategy, TableOptions.GridLineBorder, TableOptions.DrawTextWithGdiInterop, TableOptions.VerticalPixelScroll, Appearance.AnyRecordFieldCell.WrapText and Appearance.AnyRecordFieldCell.Trimming.

InvalidateAllWhenListChanged - It lets you specify whether the grid should simply call Invalidate when a ListChanged event is handled or if it should determine the area that is affected by the change and call InvalidateRange.

At first, you might think its better to determine the area that is affected by a change and call InvalidateRange. But when calling InvalidateRange, the grid needs to know the exact position of the record in the table before it can mark that area dirty. In order to determine the record position (and y-position of the row in the display), counters need to be evaluated. This operation can cost more time than simply calling Invalidate in high-frequency update scenarios. The group caption bar also needs to be updated when a record changes.

InsertRemoveBehavior, SortPositionChangedBehavior properties and UpdateDisplayFrequency can speed up things when InvalidateAllWhenListChanged is set to false.

 

Reference link: https://help.syncfusion.com/windowsforms/classic/gridgroupingcontrol/performance

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon