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.
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.