WPF OnPropertyChanged ... what is slow??

Code profiling for .NET Developers

Moderators: StephenC, Alex.Davies, AndrewH

WPF OnPropertyChanged ... what is slow??

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

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

Postby Chris.Allen » Tue Oct 13, 2009 2: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).
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby Patrick » Wed Oct 14, 2009 12:49 am

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

Postby StephenC » Thu Oct 15, 2009 1: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.

Regards,

Stephen
StephenC
 
Posts: 306
Joined: Mon Oct 15, 2007 9:18 am
Location: Cambridge

Postby Patrick » Fri Oct 16, 2009 12:29 am

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


Return to ANTS Performance Profiler 5

Who is online

Users browsing this forum: No registered users and 0 guests