we want to put a 15k * 20k table in grid. We just virtualize the Row data(we read whole record each time). But it is still very slow. So we suspect the Grid create all the cell for each record even the cell is not displayed on the screen.
Could you give us some advices on how to improve the performance?
Is the performance hit up front or constant? Virturalization can only help with performance once the dataset is loaded into the grid. The action of getting that much data actually into the application no matter how you do it is costly and will have an impact on load time.
I would suggest looking at the profiling tools in Visual Studio as well as use a tool called Snoop to look at the visual tree where you will be able to confirm that we are in fact not creating a cell for every record not on the screen.
Our datasource implement IList. We only give grid the record which grid ask for. So we don't load all data once. It is very fast.
I try profiling tools as you suggest. I find that the following function in FieldLayout.cs is called twice:
private void InitializeCellPanel(Panel placeholderPanel, bool isLabelPanel) { if (null == placeholderPanel) return;
foreach (Field field in _fieldLayout.Fields) { if (!field.IsInLayout) continue;
AddPlaceholder(placeholderPanel, field, isLabelPanel); } }
The problem is _fieldLayout.Fields.Count is 25k. To finish the loop, it will cost 1~2 sec.
And the main time cost is in MeasureOverride which in VirtualizingDataRecordCellPanel.cs about 10~15 sec.
What version of NetAdvantage is this?
Hi Sam,
Yes, that's what we have to do. And by reverse-engineering the source code and use reflection to help xamdatagrid a little bit, we can only push it to 12 seconds to load, which is still too long. Please help to see if there is anything we can do to accelerate it, thanks.
I would like to clarify some of the informaiton to find out whether this is a performance issue or expected behavior. If I understand you correctly you are generating 20000 columns with 15000 rows. Correct me if I am missunderstaning it.
Thank you,
Sam
10.3 does not improve it.
I have another simlar problem about problem.
I found when I change datasource and if the original datasource is not null, grid will travel all item in the datasource. It is a very big problem. Is this improve in 10.3?
The code is in OnSourceCollectionReset in RecordManager.cs
if ( DataSourceResetBehavior.ReuseRecordsViaEnumerator == resetBehavior && sourceList != null && this._unsortedRecords.Count == newCount ) { inSameOrder = true;
i = 0;
foreach (object source in sourceList) { // JJD 1/13/08 // Bypass XmlComments if (source is System.Xml.XmlComment) continue;
DataRecord record = (DataRecord)this._unsortedRecords.SparseArray.GetItem(i, false); if (null != record) { if (!record.IsDataItemEqual(source)) { inSameOrder = false; break; } }
i++; } }
I recommend using the latest version 10.3.