Hello,
Whenever we refresh an Ultragrid control in our project, we make the following specifications (control is referenced here as "fg"):
fg.DisplayLayout.Override.CellClickAction = UltraWinGrid.CellClickAction.RowSelectfg.DisplayLayout.Override.SelectTypeRow = UltraWinGrid.SelectType.Extendedfg.DisplayLayout.Bands(0).Columns(0).Hidden = Truefg.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.Falsefg.DisplayLayout.Override.DefaultRowHeight = 25fg.DisplayLayout.Override.HeaderClickAction = UltraWinGrid.HeaderClickAction.SortSinglefg.DisplayLayout.Override.RowAppearance.TextVAlign = VAlign.Middlefg.DisplayLayout.ScrollStyle = UltraWinGrid.ScrollStyle.Immediatefg.DisplayLayout.ScrollBounds = UltraWinGrid.ScrollBounds.ScrollToFillfg.AlphaBlendMode = AlphaBlendMode.Disabledfg.DisplayLayout.MaxRowScrollRegions = 1fg.DisplayLayout.MaxColScrollRegions = 1fg.DisplayLayout.Override.RowSizing = UltraWinGrid.RowSizing.Defaultfg.DisplayLayout.PerformAutoResizeColumns(False, UltraWinGrid.PerformAutoSizeType.AllRowsInBand)
When our developers were using Infragistics version 12.1 we experienced no substantial slowdown with those specifications but upon upgrading to version 14.1 loading large datasets became very slow. We tracked this slowdown to the PerformAutoResizeColumns call. If we comment out this one line in the refresh, loading up an UltraGrid with ~17,500 rows takes roughly two seconds. However, if we un-comment that line and the control performs the re-size the reload takes approximately 40 seconds. This is slow load is unacceptable to our customers and this scenario is not uncommon at all. Is there something in the way we're calling PerformAutoResizeColumns or the way we're setting the Ultragrid properties that is causing this massive loadtime?
Thank you,Bob
Hi Bob,
I can't think of any reason why the PerformAutoResize method should be so much slower in 14.1. Although frankly, I can't see how the grid could have been working that quickly in the older version with that many rows.
I ran a test using v12.1 and 14.1 with the same application and I applied all the same settings you posted here. I ran the tests several times and the results were very consistent.
In 12.1, my test took around 14 seconds.
In 14.1, my test took about 18 seconds.
So there seems to have been a small change there, but nothing so drastic as you are reporting. Of course, the speed largely depends on the number of columns, data types, etc. My grid happens to have 19 columns with a wide variety of data types. So it may have something to do with the number and DataTypes of the columns in your application, which you didn't include here.
The first thing I would do is try setting Visual Studio to break on all exceptions and see if there are any exceptions which are occurring during the PerformAutoResizeColumns call which might be getting caught so you are not seeing them. Exceptions are a very common reason for performance issues like this.
If that doesn't help, then is there any way you could post a small sample project here demonstrating the issue so we can reproduce it?
Mike,
Thanks for your quick reply. I made a small sample project to test out the grid control and it lined up with the times you listed in your post. I'm currently not sure why it's taking so much longer in the context of our product.
Another question for you, and this one is actually not about the speed of the resize so much as it is about the difference of results of the function now in 14.1 versus what it did in 12.1. In our previous product (which used 12.1 controls), the resize worked differently using the following call:
fg.DisplayLayout.PerformAutoResizeColumns(False, UltraWinGrid.PerformAutoSizeType.VisibleRows)
I took an image capture of the results of the resize using 12.1 and 14.1. Note that 14.1 is not accounting for the longer text in the immediate visible rows and 12.1. Why is this?
We made a change (completely unrelated to AutoSizing) that can affect the timing of when the grid paints. The grid was performing some metrics calculations too early and this was both inefficient and caused some problems.
So most likely you are calling the PeformAutoResizeColumns at a time before the grid has painted for the first time. In the past, even though the grid hadn't painted, it still had some "visible" rows to work with, and now, since the row creation has been delayed, there are no visible rows to consider when doing the sizing.
BTW... the fact that you are using VisibleRows here would make your AutoSizing a lot faster than mine. In my samples, I used AllRowsInBand.
Anyway, to get the old behavior back, you can either move the call to PeformAutoResizeColumns to some later point after the grid has painted. Or, you could pass in an arbitrary number of rows, like 30, which would be enough to fill the height of the screen.
Thanks for your quick reply. Could you provide an example of number of rows being passed? I'm not seeing a parameter definition for number of rows for PerformAutoResizeColumns.
Hi,
Sorry about that. The overload I was thinking of is only on the column, it doesn't exist on the DisplayLayout. So you would do something like this:
foreach (UltraGridColumn column in this.ultraGrid1.DisplayLayout.Bands[0]) { column.PerformAutoResize(30); }