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

Yet another Grid performance issue

3 Answers 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zsolt
Top achievements
Rank 1
Zsolt asked on 17 Feb 2021, 04:11 PM

 I know grid performance has been discussed many times, but I could not derive a solution so far from those posts.

The scenario is very simple, we have to show 20 items in a grid. The data paging responsibility is ours, the grid sees only 20 rows.

When the ItemsSource changes, 1-2 sec is needed for the grid to display the new results.

The performance is bad regardless of Virtualization settings (and 20 rows do not need virtualization at all naturally).

Fixed Height and With do not help, I think this is not the usual infinite height MeasureOverride issue.

I have attached DotTrace and VS profiler traces, so you can see the problematic paths.
The profiler pinpoints MeasureOverride at the surface. Most posts about grid performance revolve around this.
However, when we dig deeper we see creating each datagrid row took about 50ms.
For 20 rows this is 1sec. This explains the perceived delay.
The attached dottrace images show that LoadContent is called many hundred times, this is what actually eats the time.

Now, it is your turn to explain what I can do to avoid this big performance overhead.

Tell me if you need more profiling data from me.

Thanks,
Zsolt

3 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 22 Feb 2021, 08:20 AM

Hello Zsolt,

Thank you for the shared pictures. 

I tried to replicate the same scenario on my end, however I am afraid that I was not able to do so. On my side, the RadGridView is refreshed smoothly after updating the ItemsSource. That is why I am attaching the project that I used for testing purposes.

Can you check it out and see how it differs from the setup on your end? If you find it possible, can you modify the project in order to reproduce the observed on your end behavior and send it back (you can do that in the support ticket that you opened, since project files cannot be attached to forum posts)? This will hopefully allow me to investigate the scenario on my end and better assist you. 

Thank you in advance for any help you can provide.

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Martin
Top achievements
Rank 1
answered on 22 Apr 2021, 07:49 AM

Hello Vladimir!

I just wanted to ask if this discussion led to a good result? We experience same performance issues with our GridViews even after applying all the recommendations from the performance improvement article. Since you provided this sample project, we did a performance profiling on that sample as well (see attached file) and got about 150ms for the MeasureOverride which seems to be mediocre regarding that the sample only contains 3 columns with 20 rows. Or am I missing something? Please let me know if there is some additional info to that topic.

Regards, Martin

0
Zsolt
Top achievements
Rank 1
answered on 22 Apr 2021, 08:20 AM

I worked with Telerik support on this scenario (they can chime in but I don't want to disclose private messages).

The main takeway was that changing the datasource object is quite slow, but changing the _content_ of the datasource is very fast.

So, you can expect the inital binding not too fast, but subquent modification will be.

I wanted to program some hidden "preloading" to make the initial binding appear fast, but I did not have time to work it out yet.

I also used RadObservableCollection instead of ObservableCollection to make the datasource change generate one big event instead of several small ones. 

In this way the grid is capable to update itself with several dozen Hz frequency (for a small number of rows).

  • Add to Phrasebook
     
    • No word lists for English → Hungarian...
       
    • Create a new word list...
  • Copy
 
Martin
Top achievements
Rank 1
commented on 30 Jun 2021, 01:44 PM

Hello,

we have a similar issue with the GridView/GridViewCellsPanel. When we have a lot of columns and rows and try to use the scrollbar of the GridView, the scrollbar freezes quite often (especially after the GridView was collapsed/hidden and became visible again), but the GridView remains responsive (rows are still selectable and you can scroll vertically with the mouse wheel).

However, I couldn’t reproduce the issue in one of the Telerik example projects.

What I tried so far to fix it:
1. Most of the performance tips from here: https://docs.telerik.com/devtools/SILVERLIGHT/controls/radgridview/performance/tips-tricks
(using fixed height and width, GroupRenderMode flat, using lightweight templates, setting the AutomationMode property of the AutomationManager to Disabled, IsLightweightModeEnabled property to true, IsPropertyChangedAggregationEnabled property to False, Avoid applying a RowStyle and/or an AlternateRowStyle, DataLoadMode)

2. reverting our style changes (as base style, we used the Windows7 Theme)

3. using a Panel as ItemsPanelTemplate, that implements GridViewCellsPanel and overrides the MeasureOverride method (but then it crashes)

I also replaced the RadGridView with a DataGrid and this worked fine without freezing.

Any help or tip would be appreciated because I would like to avoid the adjustment changes if I have to switch from RadGridView to DataGrid.

Best regards
Tags
GridView
Asked by
Zsolt
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Martin
Top achievements
Rank 1
Zsolt
Top achievements
Rank 1
Share this question
or