WPF OnPropertyChanged ... what is slow??

Code profiling for .NET Developers

WPF OnPropertyChanged ... what is slow??

Postby Patrick » Mon Oct 12, 2009 1:29 am


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?

Posts: 5
Joined: Mon Oct 12, 2009 1:23 am

Postby Chris.Allen » Tue Oct 13, 2009 1:45 pm

What happens when you create a "call graph" centered on theOnPropertyChanged method and the right-click and expand the call stack down? Does it show you further called methods?

(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).
Posts: 579
Joined: Thu Mar 12, 2009 3:17 pm

Postby Patrick » Tue Oct 13, 2009 11:49 pm

-> 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?
Posts: 5
Joined: Mon Oct 12, 2009 1:23 am

Postby StephenC » Thu Oct 15, 2009 12:18 pm

Hi Patrick,

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.


Posts: 305
Joined: Mon Oct 15, 2007 8:18 am
Location: Cambridge

Postby Patrick » Thu Oct 15, 2009 11:29 pm

I did create the callgraph and this was the hierarchy I could see in the callgraph... will try unchecking the simplified stack trace option.
Posts: 5
Joined: Mon Oct 12, 2009 1:23 am

Return to ANTS Performance Profiler Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests