ZGC.Refresh() 效率瓶颈?
我有一个在 TrackBar 滚动时刷新 1000 条线图的流程。
我做了一些 StopWatching,发现 ZGC.Refresh() 占了进程运行时间的 90%。当 TrackBar 滚动时查看图形进度的能力对于程序至关重要。有什么方法可以优化 ZGC.Refresh() 的效率,以便我的程序可以运行得更快?
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 efficiency of ZGC.Refresh() so my program can run faster?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 ANTS Performance Profiler 之类的工具来将范围缩小到具体的部分Refresh() 方法可以使用优化。
排除方法本身的优化,是否有可能生成一个比实际需要更大的图形,然后仅显示该图形的一部分,让滚动改变当前显示的图形的哪一部分?
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?
使用
Invalidate()
而不是Refresh()
- 它应该更快,因为它只会刷新那些发生更改的元素。有时需要使用组合
AxisCHange() + Invalidate()
Instead of
Refresh()
useInvalidate()
- it should be much quicker because it will refresh only those elements that changed.Sometimes it is needed to use combination
AxisCHange() + Invalidate()
任何对 ZedGraph 性能感兴趣的人都应该在这里查看我的答案。
只是想了解 2008 年之后该库的一个版本发生了变化(包括性能增强)。
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.