RadGridView SortDescriptors Slow Sort

1 Answer 132 Views
GridView
James
Top achievements
Rank 1
Veteran
James asked on 21 Apr 2022, 11:09 PM

I need help with the performance of the SortDescriptors for the RadGridview. I attached a project that demonstrates the issue.

I have two sets of data. The "Larger Data Table" has roughly twice as many rows (around 17k). The "Smaller Data Table" has around 9k rows.

  • Setting the Sort Descriptors toggle switch ON, selecting the "Larger Data Table" radio button, and clicking the [Load Data Set] button takes approximately 1 second in my environment.
  • Setting the Sort Descriptors toggle switch ON, selecting the "Smaller Data Table" radio button, and clicking the [Load Data Set] button takes approximately 7 seconds in my environment.

I have no idea what is causing this issue. However, through a ton of troubleshooting, I finally figured out it is the sort descriptors causing the issue.


James
Top achievements
Rank 1
Veteran
commented on 22 Apr 2022, 12:00 AM

For those struggling with the SortDescriptor behavior, I found another forum post describing a similar issue.

The issue is that sorting a large data table with many of the same values causes the sort to take much longer than a data table with dissimilar values.

Troubleshooting on my own, I found adding more columns to the sort descriptor list improved sort performance. Albeit not enough to stop blocking the UI for a few seconds.

A Telerik forum post suggested changing the indexer threshold, which causes the indexer to switch to a binary sort when the number of items surpasses the indexer threshold. This worked for me.

row/cells selecting slow down when sorting by column with many same values


RadDataView<GridViewRowInfo> dataView = this.grid.GridViewElement.Template.ListSource.CollectionView as RadDataView<GridViewRowInfo>;
FieldInfo indexerField = typeof(RadDataView<GridViewRowInfo>).GetField("indexer", BindingFlags.NonPublic | BindingFlags.Instance);
HybridIndex<GridViewRowInfo> indexer = indexerField.GetValue(dataView) as HybridIndex<GridViewRowInfo>;
indexer.Threshold = 500;


My recommendation for Telerik is you may want to consider exposing the indexer threshold property.

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Apr 2022, 10:01 AM

Hi, James,

I am glad that the sorting performance is improved when editing the HybridIndex.Threshold property. I confirm that it is the appropriate solution for such a scenario with identical values.  

The following KB article also demonstrates another approach for speeding up the sorting performance:

https://docs.telerik.com/devtools/winforms/knowledge-base/use-custom-comparer-to-speed-up-the-sorting-in-radgridview 

RadVirtualGrid is also a good approach to provide good performance when dealing with large amount of data: https://docs.telerik.com/devtools/winforms/controls/virtualgrid/overview 

If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
James
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or