Hi,
I am evaluating Telerik Silverlight GridView control. The control almost works fine so far. Now I am testing it with large number of rows and columns. I am seeing following behaviors that I didn’t expect. I have enabled row and column virtualization, template columns and large data set.
1) Horizontal scrolling is slower than vertical scrolling.
2) Grid doesn’t handle large number of columns as well as it handles large number of rows. For an example, grid with 2000 rows X 100 columns performs better than grid with 100 rows X 2000 columns. Grid with 2000 columns loads/scrolls slower. As numbers of visible cells are same, I was hoping that both grids should perform same.
3) As number of columns is increased, grid’s performance degrades. I was hoping that grid would perform for 2000 columns as same as it was performing for 100 columns. That’s because grid only renders visible area which is same for both cases.
It is by design? Is there any way to overcome these issues? Will they be taken care in future release?
Thank you,
Amit
65 Answers, 1 is accepted
Can you please send us your example project that illustrates this poor performance? Having it we will be able to suggest you ways to optimize your scenario.
Regards,
Stefan Dobrev
the Telerik team
Also, can you please provide of answer of following questions?
1) Dees number of columns/rows affect how fast grid get loaded?
2) Does number of column/rows affect scrolling performance?
Thank you.
Please refer to the response in your other thread.
As for the RadGrid performance you can refer to this online example how it handles 50mln cells.
Sincerely yours,
Hristo
the Telerik team
<telerik:RadGridView x:Name="ListingGrid"
ItemsSource="{Binding Listings, Mode=OneWay}"
AutoGenerateColumns="True"
EnableColumnVirtualization="True"
EnableRowVirtualization="True"
IsReadOnly="True">
Before you ask, no I don't have a sample project for you. It should be simple for you to create one. Take your 50 million cell example and replace the numbers with long strings.
We can confirm that in such extreme cases the performance of RadGridView suffers. Our engineers are putting a lot of efforts in investigating the problem and searching for a solution.
Thank you for your patience and understanding!
Sincerely yours,
Hristo
the Telerik team
When can we expect fix of the performance issue?
Thank you,
Amit
Handling such extremely large data sets is not a trivial task and we'll need more time for investigation and finding the right solution. This is why for the time being we cannot commit to any specific date or release.
Regards,
Hristo
the Telerik team
I've attached an example project with grid bound to collection of 10 items and 150 columns with long strings. Let me know what you think about the grid horizontal scroll performance.
Best wishes,Vlad
the Telerik team
It's nowhere near as smooth as when scrolling vertically with a large number of rows and 10 columns with small amounts of data. And in my app where I am databinding to a Ria Services EntitySet with a variety of field types (decimal, integer, boolean, string (with a couple of very long string fields), etc.), it is even worse. It's not unusable, but the difference in horizontal and vertical scrolling is very noticeable IMO.
FYI, my hardware is Intel Core2 Duo 2 GHz with 4 gigs of RAM running Windows 7 64 bit Ultimate. It's not state of the art, but it's better than a lot of my potential customer's machines.
You can optimize the scrolling if you specify explicitly width for the columns - you can set for example ColumnWidth="150" for the grid.
Best wishes,Vlad
the Telerik team
Thanks,
-Jarred Froman
How many columns/rows you have in your grid? More info about your scenario will be appreciated.
Kind regards,Vlad
the Telerik team
Have you tried this demo? The grid is bound collection of 500000 items with 100 properties.
Best wishes,Vlad
the Telerik team
Do you cache cell Content with your custom columns? This can improve the performance greatly - for example if you have TextBlock you can change only TextBlock Text instead creating new instance every time.
Sincerely yours,Vlad
the Telerik team
I have a sample project so but cant see how to submit it as it only allows images to be uploaded.
Regards,
Doug Rees
Polo Ralph Lauren.
Please open support ticket and attach the project.
Kind regards,Vlad
the Telerik team
Regards,
Doug Rees
They explain it perfectly, horizontal scrolling is very laggy with variable size columns and "longish" strings, I'm talking less than than 50 character strings.
I'm seeing this with around 30 rows and 20 columns, nothing special about the columns, some checkbox's as AutoGenerateColumns is set to true.
The project I am working on has been specifically commissioned to improve performance for the user, I was hoping the Telrik grid would help here.
It loads and scrolls vertical pretty well, but horizontal scrolling is, well..... laggy and a poor experience.
Any news on a potential fix ?
Thanks
D
Yesterday we fixed serious performance issue related to horizontal scrolling and the fix will be part of our upcoming latest build Today. Please check our new build (will be available later Today) and let us know if you still have such problems.
Kind regards,Vlad
the Telerik team
Thanks,
Doug
Can you please let us know when we can expect a newest build?
Our latest internal build with version 2010.2.1018 is ready for download under Your Accounts.
@ Nicolas: Our new VirtualQueryableCollectionView will be part of our Q3 2010 Beta release (not in the latest internal build) which is expected later today.
Regards,
Hristo
the Telerik team
Thank you, that is good news. I have been able to try the internal and the horizontal scrollbar performs much better indeed (still slower than the vertical scrollbar but still much better than before, where it was just unusable).
Unfortunately, using the internal build some features such as row insertion and edition do not work anymore so we'll wait until an official release.
Where will the beta be downloadable? I've searched high and low and could not find a page with betas of controls to download.
Can you send us small example application (via support ticket) demonstrating your scenario and these problems with rows insert/edit? Unfortunately we didn't manage to upload our beta Friday and we will do our best to do this Today.
Sincerely yours,Vlad
the Telerik team
I also tried the latest internal build. It fixed "Unexpected behavior with Column Virtualization". I see good performance of horizontal scrolling. I saw the same behavior as Nicolas saw. Horizontal scrolling is 2x slower than vertical scrolling. But it is much better than before.
Surprisingly, latest assemblies also broke a functionality for me. It broke cell editing functionality - I am using Custom Columns. I already updated support Ticket (ID 356186 - Unexpected behavior with Column Virtualization) with the issue. Sample application is already in support ticket.
Thank you,
Amit
FYI: editing issue has been resolved as part of support incident.
Thank you,
Amit
I have done some refactoring on custom columns, and you were right it does work significantly better if I reuse the controls already instantiated :)
I have created a dictionary that keeps my old controls, but I would like to know more about Vlad's idea of caching.
Anyway, great work with the new build, I can see that it is performing much better now ;)
Here is an example of caching:
public
class
MyColumn : GridViewDataColumn
{
public
override
FrameworkElement CreateCellElement(GridViewCell cell,
object
dataItem)
{
var textBlock = cell.Content
as
TextBlock;
if
(textBlock ==
null
)
{
textBlock =
new
TextBlock();
textBlock.SetBinding(TextBlock.TextProperty, DataMemberBinding);
cell.Content = textBlock;
}
return
textBlock;
}
}
Vlad
the Telerik team
I have tried this approach, but something is not right... when I use these cached controls, and scroll left and right, my columns get messed up, so for one header name I get column data from a different column.. :S
What am I doing wrong?
Could you please send us a sample application which can help us reproduce the issues with your custom column?
Regards,
Milan
the Telerik team
here my code
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using RadControlsSilverlightApp1.Resources;
using Telerik.Windows.Controls;
namespace RadControlsSilverlightApp1
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
DataTable table = CreateDataTable();
foreach (DataColumn column in table.Columns)
{
RadGridView1.Columns.Add(CreateColumn(column.DataType,column.ColumnName,column.ColumnHeader));
}
RadGridView1.ItemsSource = table;
}
private static GridViewDataColumn CreateColumn(Type columnType, string dataPath, string header)
{
GridViewCustomColumn column = new GridViewCustomColumn
{
DataType = columnType,
UniqueName = dataPath,
Header = header,
HeaderTextAlignment = TextAlignment.Center
};
return column;
}
private static DataTable CreateDataTable()
{
DataTable table = new DataTable();
List<
String
> s = new List<
string
>();
for (int i = 0; i < 2; i++)
{
table.Columns.Add(new DataColumn
{
ColumnName = "Prop" + i,
ColumnHeader = "Prop" + i,
DataType = typeof (String)
});
}
for (int i = 2; i < 10; i++)
{
table.Columns.Add(new DataColumn
{
ColumnHeader = "Prop"+i,
ColumnName =
"Prop"+i,
DataType = typeof (CustomCell)
});
}
int numero=0;
for (int i = 0; i < 100; i++)
{
numero++;
var r = table.NewRow();
foreach (DataColumn column in table.Columns)
{
if (column.DataType == typeof(String))
{
r[column.ColumnName] = "Content"+numero;
}
else
{
r[column.ColumnName] = new CustomCell
{
P1 = 100,
P2 = 90,
P3 = "%",
P5 = "../Images/greenSemaphore.png",
P4 = -1
};
}
}
table.Rows.Add(r);
}
return table;
}
}
}
<
UserControl
x:Class
=
"Dashboard.Silverlight.Resources.CustomCellLayout"
mc:Ignorable
=
"d"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"Transparent"
>
<
Grid
x:Name
=
"Grid"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
StackPanel
Grid.Row
=
"1"
Orientation
=
"Horizontal"
Width
=
"45"
>
<
TextBlock
x:Name
=
"TextBlockP1"
Margin
=
"5 2 5 2"
Foreground
=
"Black"
/>
</
StackPanel
>
<
StackPanel
Grid.Row
=
"1"
Grid.Column
=
"1"
Orientation
=
"Horizontal"
Width
=
"45"
>
<
TextBlock
Margin
=
"5 2 5 2"
x:Name
=
"TextBlockP2"
/>
</
StackPanel
>
<
StackPanel
Grid.Row
=
"1"
Grid.Column
=
"2"
Orientation
=
"Horizontal"
Width
=
"45"
>
<
TextBlock
Margin
=
"5 2 5 2"
x:Name
=
"TextBlockP3"
Foreground
=
"Blue"
/>
</
StackPanel
>
<
StackPanel
Grid.Row
=
"1"
Grid.Column
=
"3"
Orientation
=
"Horizontal"
Width
=
"20"
>
<
Image
Width
=
"16"
x:Name
=
"CircleImage"
Height
=
"16"
Margin
=
"5 2 5 2"
VerticalAlignment
=
"Center"
/>
</
StackPanel
>
</
Grid
>
</
Grid
>
</
UserControl
>
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Dashboard.Silverlight.Resources;
using RadControlsSilverlightApp1.Dynamic;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
namespace RadControlsSilverlightApp1.Resources
{
public class GridViewCustomColumn : GridViewDataColumn
{
public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
{
FrameworkElement element = null;
object currentProperty = null;
DynamicObject data = dataItem as DynamicObject;
if (data != null)
currentProperty = data.GetVal(cell.Column.UniqueName);
/*
I've add this method to DynamicObject
public virtual object GetVal(string propertyName)
{
object value;
if (!this.valuesStorage.TryGetValue(propertyName, out value))
{
return default(object);
}
return value;
}
*/
if (currentProperty is CustomCell)
{
var bar = cell.Content as CustomCellLayout;
CustomCell wrapper = currentProperty as CustomCell;
if (bar == null)
{
bar = new CustomCellLayout();
if (!Double.IsInfinity(wrapper.P1))
{
bar.TextBlockP1.Text = String.Format("{0:n0} {1}", wrapper.P1, wrapper.P3);
bar.TextBlockP2.Text = String.Format("{0:n0} {1}", wrapper.P2, wrapper.P3);
bar.TextBlockP3.Text = String.Format("{0:n0} {1}", wrapper.P1 - wrapper.P2, wrapper.P3);
}
else
{
bar.TextBlockP1.Text = "-";
bar.TextBlockP2.Text = "-";
bar.TextBlockP3.Text = "-";
}
if (wrapper.P4 <
0
)
{
bar.TextBlockP3.Foreground
=
new
SolidColorBrush(Colors.Red);
}
if (wrapper.P4 == 0)
{
bar.TextBlockP3.Foreground
=
new
SolidColorBrush(Colors.Orange);
}
if (wrapper.P4 > 0)
{
bar.TextBlockP3.Foreground = new SolidColorBrush(Colors.Green);
}
bar.CircleImage.Source = new BitmapImage(new Uri(wrapper.P5, UriKind.RelativeOrAbsolute));
element = bar;
cell.Content = bar;
}
}
if (currentProperty is String || currentProperty == null)
{
var bar = cell.Content as TextBlock;
if (bar == null)
{
bar = new TextBlock();
bar.Text = currentProperty != null ? currentProperty.ToString() : "-";
bar.Foreground = new SolidColorBrush(Colors.White);
LinearGradientBrush background = new LinearGradientBrush();
background.EndPoint = new Point(0.5, 1);
background.StartPoint = new Point(0.5, 0);
background.GradientStops.Add(new GradientStop { Color = 0xFF0E7094.ToColor(), Offset = 1 });
background.GradientStops.Add(new GradientStop { Color = 0xFF1990B1.ToColor() });
cell.Background = background;
element = bar;
cell.Content = bar;
}
}
return element;
}
}
}
Yes we have serious progress here and we will do our best to include the new horizontal virtualization with our Q1 2011 Beta (end of January probably).
Greetings,Vlad
the Telerik team
Have you tried to set fixed with for all columns? For example ColumnWidth="100".
Kind regards,Vlad
the Telerik team
With our latest version you can enable deferred horizontal scrolling (ScrollMode="Deferred") - may help you in your case.
All the best,Vlad
the Telerik team
We have the same issue. Out grid has 90 columns (mostly strings) and is very slow when scrolling.
When can we expect an update? That would be great.
Thanks
The release will be this week. For more info you can check my blog post and this demo.
Best wishes,Vlad
the Telerik team
100-1000+ rows
20-50 columns (user definable)
for a row load of 100 and a column count of 45 (where 60% of cells have values)
the query takes ~2s from RIA service context.Load() to DataSource.DataLoaded event
the grid.ItemsSource = context.Object.ToList(); grid.updatelayout() reports its done in under a second, but if you time to when the UI becomes active (e.g. set the focus of a button after the updatelayout) its between 5 & 6 seconds
timing is via DateTime - DateTime and not subjective - increasing or decreasing the size of the data/column count various the time dramatically (number of columns proportional to load time)
changing the columns via
this.RadGridView.Columns.RemoveItems(this.PropertyColumns);
this.PropertyColumns.Clear();
// add to PropertyColumns
this.RadGridView.Columns.AddRange(this.PropertyColumns);
also causes a hang of 5-6s for 40 columns
--Edit: Vlad posted a response whilst this post was compiled
It seems that 11 Q1 release looks much better re performance
With the radgridview in a row of height "*" the rowvirtualization works and we don't get a black screen or a big freeze up.
Is it possible to set Deffered for Vertical scrolling and RealTime for Horizontal scrolling ?
Thanks & Regards,
Kannan
My scenario is quite relevant to this thread of discussions. Telerik controls that we are using are of the version 2011.1.502.1040.
In my silverlight project, I'm using a telerik grid with virtual scrollling activated. I have users close to 1000 being shown on the grid. pagesize is 150. When I select the 1st row, and scroll down to the last user for selection (shift pressed), trying to select all users , selection happens. But if I repeat this again and again, my browser hangs. The call stack at this moment is mentioned below. Hristo had mentioned in an earlier post that the performance for VirtualQueryableCollectionView will be improved in Q3 2010 Beta release. So wanted to to know what is the current statues of this issue ?
[Managed to Native Transition]
System.Windows.dll!MS.Internal.XcpImports.DependencyObject_GetVisualRelative(System.Windows.DependencyObject referenceObject, int linkType) + 0x4d bytes
System.Windows.dll!System.Windows.Media.VisualTreeHelper.GetRelative(System.Windows.DependencyObject reference, System.Windows.Media.VisualTreeHelper.RelativeKind relativeKind) + 0x40 bytes
Telerik.Windows.Controls!Telerik.Windows.RadRoutedEventHelper.FindParent(System.Windows.FrameworkElement item) + 0x37 bytes
Telerik.Windows.Controls!Telerik.Windows.RadRoutedEventHelper.BuildRoute(System.Windows.DependencyObject element, Telerik.Windows.EventRoute route, Telerik.Windows.RadRoutedEventArgs args) + 0x7d bytes
Telerik.Windows.Controls!Telerik.Windows.RadRoutedEventHelper.RaiseEvent(System.Windows.DependencyObject element, Telerik.Windows.RadRoutedEventArgs args) + 0x4a bytes
Telerik.Windows.Controls.GridView!Telerik.Windows.Controls.GridView.GridViewDataControl.RaiseSelectionChangedEvent(Telerik.Windows.Controls.SelectionChangeEventArgs args) + 0x13 bytes
Telerik.Windows.Data!Telerik.Windows.Controls.DataControl.RaiseSelectionChangedEvent(Telerik.Windows.Data.Selection.ItemSelectionChange selectionChange) + 0x48 bytes
Telerik.Windows.Data!Telerik.Windows.Controls.DataControl.Telerik.Windows.Data.Selection.ISelectorInternal.RaiseSelectionChangedEvent(Telerik.Windows.Data.Selection.ItemSelectionChange selectionChange) + 0x6 bytes
Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.EndAllowedSelection(Telerik.Windows.Data.Selection.ItemSelectionChange selectionChange) + 0x56 bytes
Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.EndPendingSelection(Telerik.Windows.Data.Selection.ItemSelectionChange pendingSelection) + 0x37 bytes
Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.EndSelection() + 0x31 bytes
Telerik.Windows.Data!Telerik.Windows.Data.Selection.ItemSelectionHandler.SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + 0x77 bytes
System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<object>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + 0x34 bytes
System.Windows.dll!System.Collections.ObjectModel.ObservableCollection<System.__Canon>.InsertItem(int index, System.__Canon item) + 0x94 bytes
mscorlib.dll!System.Collections.ObjectModel.Collection<object>.Add(object item) + 0x69 bytes
mscorlib.dll!System.Collections.ObjectModel.Collection<object>.System.Collections.IList.Add(object value) + 0x97 bytes
We are not sure what is causing the issue at your end however you can check the actual grid performance on this demo. The grid is bound to 1 mil. records with 1000 columns.
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
in my case the problem occurs because I have multi select behaviour active on the grid. Browser hangs when I try to select around 100 users on mouse drag and scroll up and down. That is the time when the browser hangs and the call stack I have alreday shared with you. Has there been any performance improvement in the telerik grid recently ?
We believe that since your version there were serious amount of performance improvements.Please try your scenario with our latest official version (Q1 2012 SP1) and let us know how it goes.
Next week we will release our Q2 2012 - if you want you can wait for the new release and use it directly instead our current official.
Kind regards,
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
As suggested by you, I shall wait for the new release.. thanks a lot...
My new version of telerik controls is : 2012.2.725.1050 and my problem continues to exist. Is this issue resolved in my version of telerik controls ?
Regards
Anjani
As far as I can see you are using PageSize along with the VirtualQueryableCollectionView. Basically, the idea behind data virtualization is to load data on-demand depending on LoadSize property. In this case using PageSize is not necessary. You can either choose using RadDataPager or DataVirtualization.
I am attaching a sample project where the multiple selection works as expected.
Let me know if you have additional questions.
Regards,
Yordanka
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I I have requirement from client where in business wanted to replace their excel sheet with Gridview control on a web application. Just wondering if TELERIK can support here for 1000 columns and 150,000 records on a Gridview. I would greatly appreciate your suggestions here.
Hi,
I have a problem with the performance of the RadGrid when I import a large amount of data from an Excel file.
What a do first is convert the Excel file into a DataTable (dtExcel), once I have that I do the following:
foreach (DataRow dr in dtExcel.Rows)
{
dtGrid.Rows.Add(dr.ItemArray);
}
Most of the times, the grid already contains data that's why I use .Add method, because I need to add all those rows at the end of the grid. Otherwise I'll use a datasource=dtExcel, but this is not the case to use that.
The datatable contains 4.500 rows and 9 columns, which are not many columns but it still very slow. It takes around 20min to import 4.500 rows in the radgrid. What I am doing wrong? what's the best way to do this?
Please gays I need your help, I'd appreciate it
Thanks a lot in advance! :)
Since this forum is intended for discussion of the controls in the UI for WPF suite, could you please open a new thread in the WinForms forum so that we can assist you properly.
Thank you in advance for your cooperation and understanding.
Regards,
Vladimir Stoyanov
Progress Telerik