05-10-2016 05:44 AM
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?
05-10-2016 06:55 AM
The first project contains errors.
attached working project.
05-10-2016 04:56 PM
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.