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

[Solved] Grid Performance Tweaks - Feedback required

3 Answers 194 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John
Top achievements
Rank 1
John asked on 26 Jan 2011, 11:50 AM
Hi,

In the CellEditTemplate I have autocomplete textboxes with multiple bindings (ItemsSource,IsDropDownOpen,Text) and in the CellTemplate I have a simple TextBlock which shows the bound Text value.

I assume this improves the performance of the Telerik Grid, please correct me if this assumption is wrong. 

I am trying to improve the performance of the Grid.

1) Use Cell & CellEdit Templates to reduce use of complex controls and multiple bindings unless a row is being updated
2) Set column and row virtualisation to false (we don't have that many rows or columns and that improved scrolling performance greatly).
3) Move DataTemplates into UserControl.Resources instead of inline
4) Look to avoid the use of usercontrols within the row.
5) Use GridViewColumn instead of GridViewDataColumn (each control has it's binding setup within the datatemplate and we are currently not using sorting/grouping etc) as a base class of my custom column (although I noticed that I can no longer switch to edit mode by setting focus to a cell and typing.....I have to set focus to the row/cell and then click a second time to enter it......is there an easy way of porting that behaviour to my custom column?).
6) Set the details view visibility to collapsed............Is there a way of triggering the details view to show from the item it is bound to (each row is bound to a ViewModel)? I had it always visible and a stackpanel within it that was collapsed and made visible as when needed....although when I added lots of rows the details row would sometimes appear as a thin white line on some of the rows).
7) Update to the latest Telerik assemblies.

I also stripped all custom styles.......when I had them enabled it seemed to add a few Mb to memory every time I added a row :S (at the moment the addition of a row adds 200k-600k) part of this is the viewmodel being setup but it is strange that rows would appear to add so much. Now I'll be adding styles back one at a time to see which is the main culprit.

Any recommendations on how to improve performance. It seems that scrolling through the rows with the arrow keys causes CPU usage to jump quite a bit as well.

Thanks,

John

3 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 26 Jan 2011, 08:49 PM
When adding styles again memory seems to jump up on an escalating scale....at one point adding 20Mb just for adding a single row to the collection.

After stripping out buttons (anything with command) it seems a bit better but it eventually throws a Layout Cycle detected error.

Any thoughts?
0
Accepted
Tyree
Top achievements
Rank 2
answered on 27 Jan 2011, 03:04 PM
I can share my experiences.

The latest release does address template caching so using a celltemplate isn't as bad as it was - but AVOID a CellTemplate all-together provides better scrolling performance.
Commands do slow it down, setting the CanExecute portion to null resulted in better performance for us.
Unless they have addressed it recently, implicit styles are much faster then explicit.
AlternationCount use can slow down adding, editing, and deleting rows in certain circumstances.
Open, or previously opened rowdetails will slow down scrolling.
Do not edit row details visibility in multiple places - things get confused.
Ensure your viewmodels are being garbage collected.
A custom column is supposed to be faster then a CellTemplate - I have not tried this.
A GridViewDataColumn using DataMemberBinding to show simple text value is faster then a GridViewColumn with a custom CellTemplate.
Defining column widths and grid width can improve performance. This is also imporant if the rowdetails effects the width of your grid.

These are based on my personal experiences. Yours may vary.
0
John
Top achievements
Rank 1
answered on 28 Jan 2011, 11:19 AM
Hi Tyree,

Thanks for the response.

I managed to improve things and now reading your post there might be a few more things to tweak.

Good tip on the alternation count I noticed that performance improved when I removed that and a few other things and your post helped confirm that its removal helped :)

At the moment row details are always visible and content within them is hidden until the view model the row is linked to indicates that e.g. an alert should be shown. I'd prefer the details row to be hidden by default and bound to a property on the viewmodel that would show/hide it as needed.

I have a custom column but that is mainly to add a property to it. Might be worth looking at it in more detail.

Thanks,

John

Tags
GridView
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Tyree
Top achievements
Rank 2
Share this question
or