WPF OnPropertyChanged ... what is slow??
Patrick
Posts: 7
Hi,
I am trying to figure out how to profile a WPF application. I see that the slow down seems to be the OnPropertyChanged event and therefore I suspect that it is some data binding that is slow.
My question is how can I get to the details? Which listener is slowest? The methods mentioned in the Method list stops at the OnPropertyChanged method?
Any tips or pointers?
cheers,
Patrick
I am trying to figure out how to profile a WPF application. I see that the slow down seems to be the OnPropertyChanged event and therefore I suspect that it is some data binding that is slow.
My question is how can I get to the details? Which listener is slowest? The methods mentioned in the Method list stops at the OnPropertyChanged method?
Any tips or pointers?
cheers,
Patrick
Comments
(The call graph view can be selected by clicking on the small blue/green/yellow icon that appears to the right of each method when clicked on).
-> PropertyChangedEventManager.OnPropertyChanged
-> WeakEventManager.DeliverEventToList
-> PropertyPathWorker.ReceiveWeakEvent
-> ClrBindingWorker.OnSourcePropertyChanged
-> OnPropertyChangedAtLevel
-> PropertyPathWorker.UpdateSourceValueState
-> PropertyPathWorker.UpdateSourceValueState
-> ClrBindingWorker.NewValueAvailable
-> BindingExpression.TransferValue
-> BindingExpression.Invalidate
-> DependencyObject.InvalidateProperty
-> DependencyObject.UpdateEffectiveValue
-> (Simplified stack traces - ANTS Performance PRofiler has simplified child stack traces to reduce memory usage)
-> last message repeats (lots of times)....
Apparently it is some sort of binding but I have lots of bindings and it would be good to know which ones are taking the longest to update the value?
i'm assuming from your description that you haven't created the Call Graph that Chris was referring to.
If you select the OnPropertyChanged method from the TreeView you will notice an icon appears in the selected row. If you create a call graph by clicking on that graph the view may reveal something a little more informative about the issue.
The other point you raised about the simplified stack trace in the TreeView is a measure that we implemented to help reduce the impact of profiling on the performance of the application. This option can be turned off so that you see more methods (although the stack trace could be huge as a result) by going to Tools > Options prior to starting profiling and unchecking the "Simplify very complex stack traces to save memory" option. This may have a negative impact on profiling performance.
Regards,
Stephen