This is a migrated thread and some comments may be shown as answers.

Very slow sorting with 100,000+ rows problem

4 Answers 761 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Phi
Top achievements
Rank 1
Phi asked on 31 Oct 2010, 02:46 AM
I have multiple grids with 100,000+ rows in them. I found that allowing RadViewGrid control to do the sorting is very slow and freezes the application while sorting. I am thinking about implementing a SortableBindingList and do my sorting outside the grid and force it to show the newly sorted BindingList when done.

However, this means I have to turn sorting off in the grid, loosing the sort indicator and the context menu options for sorting.

What would you suggest in this scenario?

Thanks,

Phi

4 Answers, 1 is accepted

Sort by
0
Phi
Top achievements
Rank 1
answered on 02 Nov 2010, 03:07 AM
This is a follow up on what I had done to resolve this issue. The main problem with grid's sorting speed is due to using Reflection to retrieve the property value of binding object while sorting. I decided to turn off grid's sorting feature and implemented my own SortableBindingList<T> class without using Reflection. This speeds thing up a lot. Just have to add a sort direction indicator graphic to the header row and voila!
0
Phi
Top achievements
Rank 1
answered on 03 Nov 2010, 06:34 PM
Darn! It was working fine and now it is not! I used the following CellClick event to detect when the user clicked on the column's header and sort the column accordingly.The sorting thing is very fast. I used this inside my Binding source to trigger the grid to refresh:

this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));

However, getting the grid updated was extremely slow! I tried several other methods hoping to have the grid update much faster without success!

private void gridView_CellClick(object sender, GridViewCellEventArgs e)
{
    // Make sure user is clicked on the header row
    if (e.RowIndex == -1 && e.Row is GridViewTableHeaderRowInfo)
    {
        this.Cursor = Cursors.WaitCursor;
 
        //gridView.TableElement.BeginUpdate();
 
        if (DataType == Classes.DataType.HanViet)
            Sort(BindingData as SortableBindingList<HanVietInfo>, e.Row, e.ColumnIndex);
        else if (DataType == Classes.DataType.VietPhrase)
            Sort(BindingData as SortableBindingList<VietPhraseInfo>, e.Row, e.ColumnIndex);
        else
            Sort(BindingData as SortableBindingList<FrequencyInfo>, e.Row, e.ColumnIndex);
 
        //gridView.TableElement.EndUpdate(true); // Very slow
        //gridView.MasterTemplate.Refresh(); // Not work either
        //gridView.DataSource = BindingData; // Not work at all
         
        this.Cursor = Cursors.Default;
    }
}

Any suggestion?

Thanks,

Phi
0
Phi
Top achievements
Rank 1
answered on 03 Nov 2010, 06:40 PM
Found the source of the problem: I turned on the AllowRowResize property to True and that slowed thing down a whole lot!!! Is this some kind of bug with the Grid since it should only effect rows inside the view port?

Phi
0
Julian Benkov
Telerik team
answered on 04 Nov 2010, 03:37 PM
Hi Phi,
Please accept my apologies for the delayed answer. We have been working on the final preparations for the official Q2 2010 release.
Please accept my apologies for the delayed answer. We have been working on the final preparations for the official Q2 2010 release.
You can use a custom sorting operation in this scenario. You can handle the CustomSorting event and compare the values by casting the DataBoundItem to your business object to avoid Reflection code. In Q3 2010 we will introduce great improvements in our custom sorting, custom grouping and custom filtering data operations. In the new version of RadGridView you will be able to change the comparer of Rows in GridViewTemplate used in the sorting operation.

Generally, the AllowRowResize property should not slow down the performance. In case there is a noticeable delay caused by the usage of this functionality, please open a new ticket and send me the project where this issue can be reproduced. This will allow us to investigate the case further.

All the best,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Phi
Top achievements
Rank 1
Answers by
Phi
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or