I have a process that refreshes a 1000 line graph while a TrackBar scrolls.
I've done some StopWatching and found that ZGC.Refresh() accounts for 90% of the process run time. The ability to see the graph progress as the TrackBar scrolls is essential to the program. Is there any way to optimize the e开发者_运维技巧fficiency of ZGC.Refresh() so my program can run faster?
You could use something like ANTS Performance Profiler to narrow it down to exactly what part of the Refresh() method could use optimization.
Excluding optimization to the method itself, would it be possible to generate a graph that is larger than you actually need and then display only a portion of that graph, letting the scroll change what portion of the graph is currently displayed?
Instead of Refresh()
use Invalidate()
- it should be much quicker because it will refresh only those elements that changed.
Sometimes it is needed to use combination AxisCHange() + Invalidate()
Anyone interested in ZedGraph performance should see my answer here.
Just trying to get the word out about a version of the library that has seen changes (including performance enhancements) after 2008.
精彩评论