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.
NetAdvantage_WPF_20102.2045_Source
I recommend using the latest version 10.3.
Sam
10.3 does not improve it.
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,
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.