We are experiancing very poor performance of child rows in our application, it just freezes until I kill the process. We have real time data updates on the grid (and this data is throttled to increase performance). If there are 2000 rows (Real time data updating) without any child records, It works ok.
But If I enable (even if single) child record, app freezes after few seconds. I did profiling and only difference I could find with Child record and without child record was call to System.Data.DataRelationPropertyDescriptor.GetValue. This calls eats up lots of CPU time.
See the Call Tree, taken from DotTrace profiler.
5.82 % System.Data.DataRow.EndEdit... - 1503602* ms - 200175 calls 5.25 % OnListChanged - 1357184* ms - 278186 calls - Infragistics.Windows.Helpers.BindingListChangedEventManager.OnListChanged(Object, ListChangedEventArgs) 5.25 % System.Windows.WeakEventManager.DeliverEvent... - 1357128* ms - 278186 calls 5.25 % ReceiveWeakEvent - 1356129* ms - 278186 calls - Infragistics.Windows.DataPresenter.RecordManager.ReceiveWeakEvent(Type, Object, EventArgs) (from System.Windows.IWeakEventListener) 5.25 % OnChangeNotification - 1356058* ms - 278186 calls - Infragistics.Windows.DataPresenter.RecordManager.OnChangeNotification(Object, Object, Boolean) 5.25 % ProcessChangeNotification - 1355660* ms - 278186 calls - Infragistics.Windows.DataPresenter.RecordManager.ProcessChangeNotification(Object, Object) 5.25 % OnBindingListChanged - 1355607* ms - 278186 calls - Infragistics.Windows.DataPresenter.RecordManager.OnBindingListChanged(Object, ListChangedEventArgs) 5.17 % RefreshCellValues - 1336220* ms - 135180 calls - Infragistics.Windows.DataPresenter.DataRecord.RefreshCellValues(Boolean, Boolean, Boolean) 4.38 % GetCellValue - 1130658* ms - 111441 calls - Infragistics.Windows.DataPresenter.DataRecord.GetCellValue(Field, Boolean) 4.38 % GetCellValueHelper - 1130583* ms - 111441 calls - Infragistics.Windows.DataPresenter.DataRecord.GetCellValueHelper(Field) 4.38 % System.Data.DataRelationPropertyDescriptor.GetValue... - 1130346* ms - 111441 calls 0.70 % SetDataSource - 180768 ms - 111440 calls - Infragistics.Windows.DataPresenter.RecordManager.SetDataSource(IEnumerable, Boolean) 0.07 % RaiseInitializeRecord - 17729 ms - 135179 calls - Infragistics.Windows.DataPresenter.DataPresenterBase.RaiseInitializeRecord(Record, Boolean) 0.01 % SyncValueWithCellValue - 2638 ms - 58485 calls - Infragistics.Windows.DataPresenter.CellValuePresenter.SyncValueWithCellValue(DataRecord, Field) 0.07 % RefreshCellValue - 18685 ms - 143006 calls - Infragistics.Windows.DataPresenter.DataRecord.RefreshCellValue(String, Boolean)
I have tried all version (10.2,10.1,9.1 with latest service packs) None of them is able to handle Real time data updates even if there is single Child record.
We already have Virtualization enabled in the grid.
_grid.RecordContainerGenerationMode = Infragistics.Windows.Controls.ItemContainerGenerationMode.Recycle;//ItemContainerGenerationMode.Virtualize _grid.CellContainerGenerationMode = CellContainerGenerationMode.Recycle;//CellContainerGenerationMode.Virtualize _grid.RecordLoadMode = RecordLoadMode.LoadOnDemand;
Can some one please help?
Thanks,
Naveen
Adding more call tree:
100.00 % EndEdit - 1535424* ms - 205311 calls - System.Data.DataRow.EndEdit() 100.00 % SetNewRecord - 1535383* ms - 205290 calls - System.Data.DataRow.SetNewRecord(Int32) 100.00 % SetNewRecord - 1535354* ms - 205290 calls - System.Data.DataTable.SetNewRecord(DataRow, Int32, DataRowAction, Boolean, Boolean) 99.99 % SetNewRecordWorker - 1535295* ms - 205290 calls - System.Data.DataTable.SetNewRecordWorker(DataRow, Int32, DataRowAction, Boolean, Int32, Boolean, Exception &) 92.66 % RecordStateChanged - 1422653* ms - 205290 calls - System.Data.DataTable.RecordStateChanged(Int32, DataViewRowState, DataViewRowState, Int32, DataViewRowState, DataViewRowState) 92.65 % RecordStateChanged - 1422508* ms - 614295 calls - System.Data.Index.RecordStateChanged(Int32, DataViewRowState, DataViewRowState, Int32, DataViewRowState, DataViewRowState) 89.60 % OnListChanged - 1375761* ms - 410560 calls - System.Data.Index.OnListChanged(ListChangedType, Int32, Int32) 89.59 % OnListChanged - 1375652* ms - 205270 calls - System.Data.Index.OnListChanged(ListChangedEventArgs) 89.59 % Notify<T1, T2, T3> - 1375602* ms - 205270 calls - System.Data.Listeners<TElem>.Notify<T1, T2, T3>(T1, T2, T3, Action<TElem, TElem, T1, T2, T3>) 89.58 % <OnListChanged>b__2 - 1375497* ms - 205270 calls - System.Data.Index.<OnListChanged>b__2(DataViewListener, ListChangedEventArgs, Boolean, Boolean) 89.58 % IndexListChanged - 1375474* ms - 205270 calls - System.Data.DataViewListener.IndexListChanged(ListChangedEventArgs) 89.58 % IndexListChangedInternal - 1375429* ms - 205270 calls - System.Data.DataView.IndexListChangedInternal(ListChangedEventArgs) 89.58 % IndexListChanged - 1375383* ms - 205270 calls - System.Data.DataView.IndexListChanged(Object, ListChangedEventArgs) 89.58 % OnListChanged - 1375356* ms - 205270 calls - System.Data.DataView.OnListChanged(ListChangedEventArgs) 89.53 % OnListChanged - 1374611* ms - 205270 calls - Infragistics.Windows.Helpers.BindingListChangedEventManager.OnListChanged(Object, ListChangedEventArgs) 89.52 % DeliverEvent - 1374584* ms - 205270 calls - System.Windows.WeakEventManager.DeliverEvent(Object, EventArgs) 89.49 % DeliverEventToList - 1374016* ms - 205270 calls - System.Windows.WeakEventManager.DeliverEventToList(Object, EventArgs, ListenerList) 89.48 % ReceiveWeakEvent - 1373852* ms - 205270 calls - Infragistics.Windows.DataPresenter.RecordManager.ReceiveWeakEvent(Type, Object, EventArgs) (from System.Windows.IWeakEventListener) 89.47 % OnChangeNotification - 1373802* ms - 205270 calls - Infragistics.Windows.DataPresenter.RecordManager.OnChangeNotification(Object, Object, Boolean) 89.45 % ProcessChangeNotification - 1373511* ms - 205270 calls - Infragistics.Windows.DataPresenter.RecordManager.ProcessChangeNotification(Object, Object) 89.45 % OnBindingListChanged - 1373473* ms - 205270 calls - Infragistics.Windows.DataPresenter.RecordManager.OnBindingListChanged(Object, ListChangedEventArgs) 88.88 % RefreshCellValues - 1364713* ms - 140100 calls - Infragistics.Windows.DataPresenter.DataRecord.RefreshCellValues(Boolean, Boolean, Boolean) 75.01 % GetCellValue - 1151679* ms - 115316 calls - Infragistics.Windows.DataPresenter.DataRecord.GetCellValue(Field, Boolean) 75.00 % GetCellValueHelper - 1151603* ms - 115316 calls - Infragistics.Windows.DataPresenter.DataRecord.GetCellValueHelper(Field) 74.99 % GetValue - 1151356* ms - 115316 calls - System.Data.DataRelationPropertyDescriptor.GetValue(Object) 74.98 % CreateChildView - 1151335* ms - 115316 calls - System.Data.DataRowView.CreateChildView(DataRelation) 70.95 % RelatedView..ctor - 1089353* ms - 115316 calls - System.Data.RelatedView..ctor(DataColumn [], Object []) 70.94 % DataView..ctor - 1089217* ms - 115316 calls - System.Data.DataView..ctor(DataTable, Boolean) 70.88 % RegisterMetaDataEvents - 1088345* ms - 115316 calls - System.Data.DataViewListener.RegisterMetaDataEvents(DataTable) 70.81 % RegisterListener - 1087303* ms - 115316 calls - System.Data.DataViewListener.RegisterListener(DataTable) 63.27 % UnregisterMetaDataEvents - 971419* ms - 113451 calls - System.Data.DataViewListener.UnregisterMetaDataEvents(Boolean) 55.32 % remove_CollectionChanged - 849404* ms - 226901 calls - System.Data.DataRelationCollection.remove_CollectionChanged(CollectionChangeEventHandler) 55.32 % Remove - 849356* ms - 226901 calls - System.Delegate.Remove(Delegate, Delegate) 55.32 % RemoveImpl - 849332* ms - 226901 calls - System.MulticastDelegate.RemoveImpl(Delegate) 53.69 % Equals - 824400* ms - 258640524 calls - System.MulticastDelegate.Equals(Object) 52.36 % Equals - 803961* ms - 258640524 calls - System.Delegate.Equals(Object) 0.93 % DeleteFromInvocationList - 14253 ms - 226900 calls - System.MulticastDelegate.DeleteFromInvocationList(Object [], Int32, Int32, Int32) 0.07 % NewMulticastDelegate - 1031 ms - 226900 calls - System.MulticastDelegate.NewMulticastDelegate(Object [], Int32, Boolean) 3.96 % remove_RelationPropertyChanged - 60821 ms - 226901 calls - System.Data.DataRelationCollection.DataTableRelationCollection.remove_RelationPropertyChanged(CollectionChangeEventHandler) 2.09 % remove_ColumnPropertyChanged - 32099 ms - 113451 calls - System.Data.DataColumnCollection.remove_ColumnPropertyChanged(CollectionChangeEventHandler) 1.88 % remove_CollectionChanged - 28924 ms - 113451 calls - System.Data.DataColumnCollection.remove_CollectionChanged(CollectionChangeEventHandler) 2.88 % UnregisterListChangedEvent - 44272 ms - 113450 calls - System.Data.DataViewListener.UnregisterListChangedEvent() 1.70 % get_IsAlive - 26119 ms - 623323859 calls - System.WeakReference.get_IsAlive() 0.02 % RemoveAt - 263 ms - 113451 calls - System.Collections.Generic.List<T>.RemoveAt(Int32) 0.01 % add_ColumnPropertyChanged - 199 ms - 115315 calls - System.Data.DataColumnCollection.add_ColumnPropertyChanged(CollectionChangeEventHandler) 0.01 % add_CollectionChanged - 167 ms - 230630 calls - System.Data.DataRelationCollection.add_CollectionChanged(CollectionChangeEventHandler) 0.04 % SuppressFinalize - 591 ms - 115316 calls - System.GC.SuppressFinalize(Object) 4.02 % SetIndex - 61697 ms - 115315 calls - System.Data.RelatedView.SetIndex(String, DataViewRowState, IFilter) 12.20 % SetDataSource - 187366 ms - 115315 calls - Infragistics.Windows.DataPresenter.RecordManager.SetDataSource(IEnumerable, Boolean) 11.98 % OnSourceCollectionReset - 183875 ms - 115315 calls - Infragistics.Windows.DataPresenter.RecordManager.OnSourceCollectionReset() 5.88 % VerifySort - 90274 ms - 115315 calls - Infragistics.Windows.DataPresenter.RecordManager.VerifySort() 5.80 % set_SortOperationVersion - 89114 ms - 115315 calls - Infragistics.Windows.DataPresenter.FieldLayout.set_SortOperationVersion(Int32) 0.05 % RaiseChangeEvents - 738 ms - 115315 calls - Infragistics.Windows.DataPresenter.RecordCollectionBase.RaiseChangeEvents(Boolean) 2.96 % GetDefaultLayoutForItem - 45470 ms - 115187 calls - Infragistics.Windows.DataPresenter.FieldLayoutCollection.GetDefaultLayoutForItem(Object, IEnumerable, PropertyDescriptorProvider) 1.79 % EndUpdate - 27468 ms - 115315 calls - Infragistics.Windows.DataPresenter.RecordManager.EndUpdate(Boolean) 1.23 % InitializeFieldLayout - 18835 ms - 230502 calls - Infragistics.Windows.DataPresenter.RecordManager.InitializeFieldLayout(FieldLayout) 0.08 % OnDataChanged - 1214 ms - 230630 calls - Infragistics.Windows.DataPresenter.RecordManager.OnDataChanged(DataChangeType, DataRecord, Field) 0.01 % GetEnumerator - 158 ms - 115315 calls - System.Data.DataView.GetEnumerator() 0.22 % VerifyListSourceToUse - 3326 ms - 115315 calls - Infragistics.Windows.DataPresenter.RecordManager.VerifyListSourceToUse() 1.20 % RaiseInitializeRecord - 18366 ms - 140099 calls - Infragistics.Windows.DataPresenter.DataPresenterBase.RaiseInitializeRecord(Record, Boolean) 0.17 % SyncValueWithCellValue - 2638 ms - 58485 calls - Infragistics.Windows.DataPresenter.CellValuePresenter.SyncValueWithCellValue(DataRecord, Field) 0.06 % MoveNext - 850 ms - 22339972 calls - System.Collections.Generic.List<T>.Enumerator.MoveNext() 0.05 % get_Current - 734 ms - 22199872 calls - System.Collections.Generic.List<T>.Enumerator.get_Current() 0.53 % RefreshCellValue - 8191 ms - 65170 calls - Infragistics.Windows.DataPresenter.DataRecord.RefreshCellValue(String, Boolean) 0.01 % GetItem - 187 ms - 205270 calls - Infragistics.Windows.DataPresenter.UnsortedRecordSparseArray.GetItem(Int32, Boolean) 0.01 % get_Item - 180 ms - 140100 calls - System.Data.DataView.get_Item(Int32) (from System.Collections.IList) 0.02 % get_Item - 282 ms - 205270 calls - MS.Internal.WeakEventTable.get_Item(WeakEventManager, Object) 0.02 % GetRow - 327 ms - 383373 calls - System.Data.DataView.GetRow(Int32) 1.85 % GetIndexByKey - 28378* ms - 821182 calls - System.Data.RBTree<K>.GetIndexByKey(K) 0.87 % UpdateNodeKey - 13287 ms - 410560 calls - System.Data.RBTree<K>.UpdateNodeKey(K, K) 0.22 % AcceptRecord - 3425 ms - 410580 calls - System.Data.Index.AcceptRecord(Int32, IFilter) 0.08 % CompareRecords - 1171 ms - 410560 calls - System.Data.Index.CompareRecords(Int32, Int32) 6.49 % EvaluateExpressions - 99669 ms - 205290 calls - System.Data.DataTable.EvaluateExpressions(DataRow, DataRowAction, List<DataRow>) 0.71 % FreeRecord - 10940 ms - 205290 calls - System.Data.RecordManager.FreeRecord(Int32 &) 0.06 % InsertRange - 871 ms - 177101 calls - System.Collections.Generic.List<T>.InsertRange(Int32, IEnumerable<T>) 0.02 % GetChildRows - 316 ms - 177101 calls - System.Data.DataRow.GetChildRows(DataRelation, DataRowVersion) 0.01 % RaiseRowChanging - 162 ms - 205290 calls - System.Data.DataTable.RaiseRowChanging(DataRowChangeEventArgs, DataRow, DataRowAction, Boolean)
Haveen,
I set up a sample project to test this scenario. For me to have a real time data, I used random number generator. I use a collection with 3 columns, some parent records, and one of the record contains 2000 child records. Every 2 second it re-generates random numbers and rebinds to the grid.
With this setup, I don't see any issues.
Can you take that attached sample and try to modify and reproduce the issue you have with your application?
Thank you,
Sam
Hi Sam,
I have created a support case CAS-49388-NZPMWQ for this, also attached a sample app that reproduces the issue, can you please look at that?
thanks,
Naveen,
I have sent notification to you (through the private support case you opened with us) that this issue was fixed in the latest WinClient/WPF Service Release that went out last week.
Francis
I am adding my comments from the case that I responded to you earlier as a suggested answer here.
I think the Thread.Sleep() is the problem. It does not guarantee the accurate duration of sleep time. It may freeze the service that is requested to stop or even kill the thread.
I have replaced the TreadSleep() with Timer, and it works as expected. I am attching the modified version of your sample. Please test it and let me know your thoughts on this approach. Take a look at the sections marked as:
"CHANGES Start *************""CHANGES End *************"
Thank you for the sample.
It seems like the performance issue is caused by adding a record in the background thread, which is not supported. XamGrid only supports changing cell value for an existing record in another thread.Let me know if you have anu question.