Hi,
On a form I have 4 UltraCombos (2 x product code, product name) bound to a 2 properties (product1 code, product2 code) on a entity. The combos' data source is made of 20k product records. The combos are bound to 2 bindingsources, one for product1, the other for product2.
The editing form load extremely slow when the two properties on the entity is bound using DataBindings to the combo's values.
What can I do to speed it up?
The form is created only once, when the app is started. The products list is bound to the BindingSources at the same time. The form is shown only when the user add a new entit, or modifies an existing one.
I'm a little fuzzy on exactly how you have thing set up. You say you have 4 UltraCombos bound to 2 properties? How does that work? The other two combo's are unbound?
When you say ' bound' are you referring to the list? Or are you binding the Value or Text property on the control? If the latter, does not binding the ValueText make any difference to the performance?
Does the form load faster if you don't bind the Combos, but still load the data from the data source?
Are you handling any events on the combos?
Have you read the WinGrid Performance Guide? UltraCombo is derived from the same base class as UltraGrid, so many of the same performance issues apply.
Also, what version are you using?
Hi Mike,
I have 2 sets of combos: cboProductCode and cboProductName, both of them have data binding to the entity's ProductCode property:cboProductCode.DataBindings.Add("Value", _entityBindingSource, "ProductCode"); cboProductName.DataBindings.Add("Value", _entityBindingSource, "ProductCode");
I have also tried binding the cboProductCode to the entity's property and the cboProductName to cboProductCode's value: cboProductCode.DataBindings.Add("Value", _entityBindingSource, "ProductCode");cboProductName.DataBindings.Add("Value", cboProductCode, "Value");
The combos have the data source a binding source which is linked to a list of 20k records. When I say "bound" I mean the data source of the control is linked to a BindingSource which is linked to a list.
I don't see any difference in loading the form when the property has a data binding to combo or not. If the _productBindingSource is not linked to the list of records the form load instantly.
I am not handling any events on the combos. I am using the last version of controls, 12.2.20122.2027, on .NET Framework 4.0 Client Profile. Also my computer is quite new: a i5-3550 processor, a intel 330 SSD and 4GB of RAM.
And I have read the WinGrid Performance Guide on the day you have published it, and any time I get into performance issues in my apps.
I looked at your sample, and I ran a performance profiler. A large portion of the time seems to be caused by the call to ValidateChildren in your ProdusInShowroom setter. I'm not sure why you are doing this. I guess it's really for cases when the dialog has already been used once and has content and then the ProdusInShowroom changes. But this is causing a delay initially because this ProdusInShowroom property is getting set before the form has displayed and so the controls on the form haven't been 'bound' yet. The Text of each of the UltraCombo controls at this point is an empty string, so the UltraCombo ends up looping through every row looking for an empty string and there isn't one, so it creates all of the rows unnecessarily.
Removing that line of code doesn't produce a huge increase in performance, but it is significant. After that, I ran my performance profiler again, but I don't see anything obvious that could be improved any further - at least not on your end. The Combo is still creating all of the rows up front in response to the setting of the control's Value (via DataBinding).
If removing the ValidateChildren call still isn't enough for your application, let me know I will ask Infragistics Developer support to write this up for developer review and we can see if there is anything else we can do to improve the performance here.
I am using the ValidateChildren to validate the values entered using Microsoft's Entreprise Library Validation Block with WinForms integration, which is set up using the BusinessEntityToControlsLinker class. I have stripped that part out because I couldn't upload more that 1MB and I was a little bit over.
I can get that line out. But I still fell it slow. Have you seen the lag you get when initialy tabbing through the combos, especially when the DropDownSearchMethod is set to Default?
ehaisiuc said:Have you seen the lag you get when initialy tabbing through the combos, especially when the DropDownSearchMethod is set to Default?
No... you didn't mention anything about that, did you?I thought you were talking about the initial load time of the form. That's what the timers in your app are displaying.
So I tried it out, now. I see what you mean. The first time the control gets focus, it's taking a really long time. After that, it's fine. My guess is that it's building the sorted list again the first time the control receives focus. That seems to indicate that it thinks that the list is dirty and needs to be updated.
It also takes a really long time for this form to load. It must be because of the building of the sorted lists, of course. Keep in mind that with 4 combos, that's 8 lists of 20,000 items each, because the combo keeps a list of both the ValueMember and DisplayMember columns.
Tabbing into the combo the first time is rebuilding one of these lists, and that's why it's slow. I'm not sure why it's doing that, since the list is already built. There must have been some change to the list at some point after it was built the first time. Is your code making changes to the data source data at any point?
I don't think the default mode is going to work for you, since building the lists takes too much time up front. You are better off with the Linear search mode.
Mike Saltzman"]Tabbing into the combo the first time is rebuilding one of these lists, and that's why it's slow. I'm not sure why it's doing that, since the list is already built. There must have been some change to the list at some point after it was built the first time. Is your code making changes to the data source data at any point?
The list that is the data source of the combos does not change at all.
Another problem is that the lag is present when using Linear search mode, when an existing record is shown, like I mimicked in the new sample attached.
ehaisiuc said:Another problem is that the lag is present when using Linear search mode, when an existing record is shown, like I mimicked in the new sample attached.
I can understand why the combo is slow in linear search mode, because it has to find the matching value on the list and it does so using a linear search. So it may have to search through all 20,000 items if the item it not found on the list.The closer the matching item is to the bottom, the slower it will be.
Hello Esam,
esam_rabba said: ... my suggestion is , on demand or on user enter a first part of word in combo box , a small logic must run to get a filtered view of data and attaching it to combo box and drop down the grid under it
If you take a look at the second UltraCombo control in my sample, you will see that I`m using Linq to filter our huge data depending of the value from first combo control. I do this using AfterDropDown event and second thread. Of course you could modify this scenario and filter your data depending of the text that your user type in the combo. Also if you get your data from database, you could use Dynamic SQL to create your query with required filter conditions.
Let me know if you have any questions.
REgards
Hi Esam,
I was thinking of exactly the same solution, but for that project I didn't had the time to do it. If a nice solution is suggested I would certainly use it in a future project, or on an upgrade.
Regards.
Hi All ,
Thanks a lot for both interaction in this subject , but i think attaching this a mount of data to combo box in any way will takes time and give a feeling of heavy in the form ,
let talk in another way , my suggestion is , on demand or on user enter a first part of word in combo box , a small logic must run to get a filtered view of data and attaching it to combo box and drop down the grid under it.
Hi Georgi,
Your sample doesn't touch the issue I found, and, from what I have understood, Esam has.
My problem is that when the combo is used as an edit control (to edit a property on a business entity) and has a lot of rows (linked to a more complex entity, with more than 2 columns) the initial drop down of the combo takes really long to show.
I have modified the sample you have attached to include the data binding of the combo with a business entity. Now, after the combo loads, clicking the down arrow takes about 3-4 seconds for the drop down to be displayed. In that lag time, the whole form freezes. After that the combo is responding great. In order to use the combo like an edit control I have to get rid of the initial lag.
Regards
This is the sample