Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph - WPF vs WINFORMS

In our project we exchanged WIN graph for WPF graph, 

but drawing performance of WIN look much better (example project is attached).

 

Is the WIN drawing performance is really faster from WPF, or the problem is in our project?

0 Kudos
Message 1 of 3
(4,089 Views)

The first project contains errors.

attached working project.

0 Kudos
Message 2 of 3
(4,084 Views)

First, thank you for the example. Having running code allows us to give more practical recommendations.


One difference I noticed between the WPF and Windows Forms code paths was that you only do a dispatcher invoke for WPF, even though both WPF and Windows Forms require updates to occur on the UI thread. WPF has more access checks and will fail earlier, whereas Windows Forms will trust most operations and can fail erratically as you make rapid updates.


Another issue with the example is that it performs an invoke for each individual plot update. A more efficient approach would be to gather all the data updates for each plot, and then perform a single invoke. After making this change locally, performance improved for both WPF and Windows Forms graphs, and eliminated the difference. This does represent a blind spot in our use case coverage, and we are probably doing more work than necessary in WPF in the original use case, but both graphs perform best when doing updates in bulk rather than piecemeal.

~ Paul H
0 Kudos
Message 3 of 3
(4,069 Views)