Articles in this section
Category / Section

How to improve the performance of WinForms GridGroupingControl?

2 mins read

Performance of GridGroupingControl

The performance of WinForms 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/gridgrouping/performance

Conclusion

 

Hope you enjoyed learning about how to improve the performance of WinForms GridGroupingControl.

You can refer to our WinForms GridGroupingControl’s feature tour page to learn about its other groundbreaking feature representations. You can explore our WinForms GridGroupingControl documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms GridGroupingControl and other WinForms components.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied