Completed
Last Updated: 21 Nov 2014 13:09 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 17 Nov 2014 16:38
Category: GridView
Type: Bug Report
1
FIX. RadGridView - Performance issue in self-referencing hierarchy when editing cell and the grid contains 50k rows
To reproduce:

public Form1()
{
    InitializeComponent();

    List<DiffItem> diffItemsMain = GetSampleDataDiffItems(12500);
    radGridView1.DataSource = diffItemsMain;
    radGridView1.Relations.AddSelfReference(radGridView1.MasterTemplate, "Index", "ParentIndex");
    radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}

private List<DiffItem> GetSampleDataDiffItems(int rootInstances)
{
    List<DiffItem> diffItems = new List<DiffItem>();
    for (int j = 0; j < rootInstances; j++)
    {
        string[,] sampleData = GetSampleDataArray();
        string parentIndex = "";
        for (int i = 0; i <= sampleData.GetUpperBound(0); i++)
        {
            DiffItem diffItem = new DiffItem(Guid.NewGuid().ToString());  
            diffItem.ObjectStatus = sampleData[i, 0];                            
            diffItem.ObjectType = sampleData[i, 1];                          
            diffItem.ObjectLabel = sampleData[i, 2];                          
            diffItem.ChangeType = sampleData[i, 3];                          
            diffItem.ObjectAccepted = sampleData[i, 4];                          
            diffItem.ParentIndex = parentIndex;                                 
            diffItems.Add(diffItem);
            parentIndex = diffItem.Index;
        }
    }
    return diffItems;
}

private string[,] GetSampleDataArray()
{
    string[,] sampleData = new string[,]
    {
        { "New", "Parent", "A572", "Added", "Undecided" },
        { "New", "Child", "CM1", "Added", "Undecided" },
        { "Modified", "GrandChild", "A573", "Modified", "Undecided" },
        { "Modified", "GreatGrandChild", "CM2", "Modified", "Undecided" }
    };
    return sampleData;
}

public class DiffItem
{
    public DiffItem(string index)
    {
        Index = index;
    }

    public string ObjectStatus { get; set; }

    public string Index { get; set; }

    public bool ObjectSelected { get; set; }

    public string ObjectType { get; set; }

    public string ObjectLabel { get; set; }

    public string ChangeType { get; set; }

    public string ObjectAccepted { get; set; }

    public string ParentIndex { get; set; }
}

Try to edit one random cell. You will notice that after pressing the Enter key to commit the changes, the editor is closed after a few seconds.

Resolution: 
The slowdown should be experienced only when editing columns which participate in the self-reference relation.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
ADMIN
Ivan Todorov
Posted on: 18 Nov 2014 12:15
We can improve the case when the user has edited a column which does not participate in building the hierarchy. If the changed value is in a column which is a member of the relation, then the update will still be needed. Updating the self-reference hierarchy involves sorting, and sorting 50000 rows using bound column accessors (retrieving the properties via property descriptors) is relatively slow in this case. This operation is not performed in a flat grid because no hierarchy needs to be built and that's why there is no slowdown when editing a flat grid.