I'm using an UltraGrid to display a large amount of hierarchical information. When given a very large data set, things slow to a crawl, and it takes seconds for the grid to respond to mouse clicks. This slowness is not in my code, I've got click handlers and they don't get called until after the delay either. Profiling shows 45.15% of execution time being spent in OnCurrentChanged and another 39.07% in OnCurrentItemChanged.
As an example, I've got a set of data that produces the following output. The top and middle bands in this particular data set each have 5,000 total rows (one row in the middle band beneath each row in the top band). The bottom band has about 1,600,000 total rows, about 300 beneath each entry in the middle band. The delay in a mouse click and my click handler getting called is consistently two seconds with this data set.
Am I simply asking too much of the UltraGrid? The output is produced by an algorithm that can process all of the data in about two minutes, but a post processing step that walks over each of the rows in the bottom band, checking a value and applying a background color based on that value is so slow as to be unusable. In my testing, it took an average of 3.5 ms per row, and at 1.6M rows, that's about an hour and a half just to iterate over the rows of the bottom band. I have not profiled what's taking so long in this loop.
I've gotten around the problem for the next release cycle and eliminated the post processing step entirely, but we're only a few weeks away from the current release and my changes have been deemed too risky to be introduced this late in development, so if there's a solution to this slowness, I still need to implement that one too.
If UltraGrid just can't handle data sets this large, I can simply disable this post processing on large data sets, but I'd really prefer not to. Slimming down the data sets is also not an option (the information in the bottom band is critical), and our users occasionally have data sets even larger than the one I've been testing with.
Hi Infragistics Support,
We are using 2013 Vol2 Infragistics Winform UltraWinGrid. I have a 3 level Hierarchical grid with first level having 9k, second level 20k and 3rd level 30k rows of data.
We are using below code to do some cell formatting. The rendering never finishes after a few hours! (I debugged and found it is always running inside the foreach loop below)
Is there a fast way to set cell or column formatting so I don't have to use the foreach loop to format each cell?
I mean can we just set a column format string like "GridColumnFormat = "###,##0;[Red]-###,##0";" like what we do in Excel?
Thanks
Steve
public virtual void InitializeRow(object sender, InitializeRowEventArgs e)
{
if (e.Row.IsGroupByRow)
return;
}
foreach (UltraGridCell gc in e.Row.Cells)
if (Utility.IsNumeric(gc.Column.Key) || Utility.IsNumeric(gc.Value))
gc.Appearance.TextHAlign = HAlign.Right;
gc.Column.Header.Appearance.TextHAlign = HAlign.Center;
double d;
bool isNumeric = double.TryParse(gc.Value.ToString(), out d);
if (isNumeric && d < 0)
gc.Appearance.ForeColor = Color.Red;
Unfortunately, the feature this was related to went through our formal quality testing some time ago, and I was unable to find a solution before that time. Thank you for your help, but no further assistance is necessary.
Hello,
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?
Thank you for using Infragistics Components.
Hello,
I have research your issue very deeply and also have tried several different approaches including usage of multi-threading, background worker, draw filters and etc. but I was not able to achieve better performance of using of InitializeRow. You have a lot of data which you want to display at once and getting of the underlying value from DataSet in order to color the row cause the issue. It seems that DataSet is very slow. If you use BindingList collection, you will get much better performance. Please see attached sample.
Please let me know if you have any further questions
I briefly attempted using InitializeRow to see if that would be faster, and got the same results. Still a little over 3ms per row.
Also profiled the ColorRows method, and the Hot Path makes it look like it's very computationally expensive to either pull data out of a row or iterate over rows in child bands, potentially both.