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.
Matt,
I've further increased the number of columns due to business need then the VS profiler shows different hot path, see attached for detail. Please advise whether there is anything we can do to improve it, thanks.
I attached the VS profiler screen shot, looks like it has something to do with measuring and sizing.
I've tried Snoop and confirmed that the visual tree only contains visible records/cells.
Pleases advise, thanks.
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.