Hi,
We have a grid that we put an UltraCombo control in the EditorComponent property of one of the column.
This works great but when we have a lot of data (e.g. 30 000 rows), it take a couple of seconds to create the datasource.
The same UltraCombo control with the same datasource directly on a form; not in the EditorComponent of a grid is approximatly 500% faster. (1.5 seconds instead of 6 seconds)
Does anybody know why the datasource is slower to initialize in the grid?
I think the reason is that the EditorComponent create a clone of the AutoComplete and that clone process many things that when put in form directlly don't process.
(I know that you will tell me that is a huge quantity of data but my customer want it like that)
What exactly do you mean by "create the datasource"?
Is this the grid's DataSource or the combo's datasource you are talking about?
Hi Mike,
The datasource is on the combobox.
Sorry if my question was not enough clear.
Okay, but what do you mean when you say that you don't understand by creating a datasource?
It is that I'm stupid?
1. Create a DataSet or a DataTable or a UltraDataSource
2. Fill it with data with your database or any other externalsource
3. Assign the datasource to the combobox (ComboBox.DataSource = DataTable or DataSet or UltraDatasource)
And don't ask me to check the performance when retreiving the data to the database; it's not what I check.
My problem is exactly on step 3 when assigning datasource to the control.
Please don't ask me another question a try to give me an answer.
If you are not able to, I will check with Reflector on the UltraWinGrid assembly.
I must have an answer before the end of the week to give my customer a final answer about the issue.
If you want to reproduce, it's simple.
Juste create a grid.
Create a gridComboBox and assign it a datasource to fill the dropdown list.
Assign the gridComboBox in the EditorComponent of one of your column in the grid.
Check the time it take.
I'm thinking the problem is because when you assign the combobox to the EditorComponent, it clone the entire datasource and the combobox but I'm not sure.
Any body have the same problem?
Okay, so you are saying it takes too long when you are assigning the DataSource property of the UltraCombo. That's what I was trying to get at. Creating the DataSource has nothing to do with the combo, which is why I was confused by the wording of your question.
The UltraCombo does create a duplicate of the data up-front in order to better support auto-complete and searching the list and to make it more efficient in use. This is a trade-off - there's a little time up front, but it makes the control faster and more responsive later on when you drop it down or when the user types into it.
You can change this behavior using the DropDownSearchMethod property. It's set to Binary by default, which means it creates a duplicate list for a Binary search. Setting this property to Linear will stop it from duplicating the list internally, but it will also make the control slower when dropping down or when the user types.
Thank you very much. I tried to set the DrowpDownSearchMethod to Linear and it's works very good in my case; the performance is approximately 400% better.
But in my original question, I said that I see a difference of performance when I set the DataSource to an UltraCombo that is on a WinForm directly in comparison to setting a DataSource to a UltraComboBox attach to the EditorComponent of a column in a grid.
I have a list of 30 000 items in a UltraComboBox assign with a UltraDataSource directly on a WinForm that take 2 seconds to load in the control. The exactly same UltraComboBox with the same source add in the EditorComponent property of a column takes 6 seconds.
In other words, the only difference is where the UltraComboBox is located.
Have you any idea that what can cause this issue of performance? Is this because the control assign in the editorComponent is cloned (thing that don't happen in a WinForm directly)?
Thank you again.
Well, it makes sense that setting the DataSource on a Combo which is being used by a grid takes longer. A Standalone UltraCombo only has to do one search of it's own list since it only has a single value.
Once you attach it to the grid, every cell in the grid has to perform a search to find the matching value on the list and display the corresponding DisplayText. So if you have 20 cell in the column, that's 20 searches instead of 1.
You might want to try Binding the UltraCombo first, before you set the EditorComponent on the column. That might be faster, but maybe not.
Having you seen the WinGrid Performance Guide? There are some tips in the guide that specifically deal with dropdowns in a grid cell and how to make sure they are as efficient as possible.
Thank you very much Mike, this work perfectly for me.
Your "WinGrid Performance Guide" contains nice tricks to improve performance.
My grids seem to be now shoot on steroïds compared to a few days ago.