C1Flexgrid performance issues

Posted by: stefan.nerlich on 20 November 2018, 1:48 am EST

    • Post Options:
    • Link

    Posted 20 November 2018, 1:48 am EST - Updated 4 October 2022, 12:10 am EST

    
    Stopwatch sw = new Stopwatch();
    sw.Start();
    
    this._fg.Rows.Clear();
    var tsCleared = sw.Elapsed;
    
    for (int j = 0; j < NUM_ROWS; j++) {
    	this._fg.Rows.Add(new Row());
    }
    
    this.txtStatus.Text = $"Grid cleared in {tsCleared.TotalMilliseconds}ms, " +
    	$"{this._fg.Rows.Count} rows with {NUM_COLUMNS} columns initialized in {sw.Elapsed.TotalMilliseconds}ms";
    
    

    When the above function is called more than once the execution time exceeds by factor 3 - 4 (Tested using Win7 and Win10 with latest C1 library). In advance im missing AddRange in C1.WPF.FlexGrid.RowCollection. Please find C# demo application attached

    C1FlexGridDemo_PerfIssues_20181120.zip

  • Posted 21 November 2018, 1:14 am EST

    Hi,

    I am able to observe what you are mentioning. However, I understand this is because once you clear the grid of the rows, you are immediately trying to add the rows.

    To resolve this, I suggest you to add the rows with some time delay, like:

                this._fg.Rows.Clear();
                var tsCleared = sw.Elapsed;
    
                await Task.Delay(200);
    
                for (int j = 0; j < NUM_ROWS; j++)
                {
    
                    this._fg.Rows.Add(new Row());
                }
    

    Doing this, the performance does not takes a hit even after multiple folds of performing the clear/addition of rows.

    Thanks,

    RuchirC1FlexgridDemo_modified.zip

  • Posted 21 November 2018, 2:32 am EST

    Hi Ruchir, thanks for your quick response. The previous (Code-Behind) sample application is just a quick hack because we found some problems with MVVM binding to C1FlexGrid.ItemSource. Anyhow… on what basis is the waiting timeout (200ms) calculated if the application will target various enviroments including Terminal server?

  • Posted 21 November 2018, 5:40 pm EST

    Hello,

    I am discussing this case with developers [ID: 354948] and will get back to you as soon as I receive some information.

    Thanks

    Ruchir

  • Posted 27 November 2018, 9:19 pm EST

    Hello,

    Please find the corrected sample resolving the performance issue.

    Thanks

    Ruchir

    C1FlexgridDemo-Corrected.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels