progressbars [英] progressbars

查看:76
本文介绍了progressbars的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个非常耗费处理器的方法,我想报告它的
进度。当我让它更新进度条,标签,打印到控制台

等时,它会大大减慢方法。


有没有办法避免这种情况?


谢谢


Andrew

解决方案



" Andrew Bullock" <一个********************* @ ANDntlworldTHIS.com>写在

消息新闻:Dc ******************* @ newsfe7-win.ntli.net ...

|

|

|

|我有一个处理器密集型的方法,我想报告它的

|进展。当我更新进度条,标签,打印到控制台

|它大大减慢了方法。

|

|有没有办法避免这种情况?

|

|谢谢

|

|安德鲁


我想你在一个辅助线程上运行它,对吗?你经常用什么来b $ b更新进度条?

当它发生时对性能有一些影响是很正常的

太频繁了。

Willy。


Willy Denoyette [MVP]写道:

" Andrew Bullock" <一个********************* @ ANDntlworldTHIS.com>在消息新闻中写道:Dc ******************* @ newsfe7-win.ntli.net ...
|
|
|
|我有一个处理器密集型的方法,我想报告它的
|进展。当我让它更新进度条,标签,打印到控制台
|它大大减慢了方法的速度。
|
|有没有办法避免这种情况?
|
|谢谢
|
|安德鲁

我想你是在一个辅助线程上运行的,对吧?,你多久一次更新进度条?
这有一些影响是很正常的当它发生时的表现太频繁了。

Willy。




不,我不运行它一个辅助线程。这会增加

性能如何更新prgbar?

谢谢


Andrew




" Andrew Bullock" <一个********************* @ ANDntlworldTHIS.com>写在

消息新闻:7z ******************* @ newsfe7-gui.ntli.net ...

| Willy Denoyette [MVP]写道:

| > 安德鲁布洛克 <一个********************* @ ANDntlworldTHIS.com>写在

| >消息新闻:Dc ******************* @ newsfe7-win.ntli.net ...

| > |

| > |

| > |

| > |我有一个处理器密集型的方法,我想报告它的

| > |进展。当我更新进度条,标签,打印到

控制台

| > |它大大减慢了方法的速度。

| > |

| > |有没有办法避免这种情况?

| > |

| > |谢谢

| > |

| > |安德鲁

| >

| >我想你是在一个辅助线程上运行它,对吗?你多久一次

| >更新进度条?

| >当它发生时会对性能产生一些影响是很正常的。

| >经常。

| >

| >

| >威利。

| >

| >

|

|不,我不在辅助线程上运行它。会这样做会增加

|性能如何更新prgbar?

|


不,它不会,但它会保持UI响应。每当你打断你的

处理器绑定时更新UI的代码路径它会损害你的b / b
性能,除非你在多核或HT CPU上运行它。

Willy。

Hi,
I have a very processor intensive method, and I want to report its
progress. When i get it to update a progressbar, label, print to console
etc. it vastly slows the method down.

Is there a way to avoid this?

Thanks

Andrew

解决方案


"Andrew Bullock" <an*********************@ANDntlworldTHIS.com> wrote in
message news:Dc*******************@newsfe7-win.ntli.net...
| Hi,
|
|
| I have a very processor intensive method, and I want to report its
| progress. When i get it to update a progressbar, label, print to console
| etc. it vastly slows the method down.
|
| Is there a way to avoid this?
|
| Thanks
|
| Andrew

I suppose you run this on an auxiliary thread, right?, How often do you
update the progress bar?
It''s quite normal that this has some impact on performance when it happens
too often.
Willy.


Willy Denoyette [MVP] wrote:

"Andrew Bullock" <an*********************@ANDntlworldTHIS.com> wrote in
message news:Dc*******************@newsfe7-win.ntli.net...
| Hi,
|
|
| I have a very processor intensive method, and I want to report its
| progress. When i get it to update a progressbar, label, print to console
| etc. it vastly slows the method down.
|
| Is there a way to avoid this?
|
| Thanks
|
| Andrew

I suppose you run this on an auxiliary thread, right?, How often do you
update the progress bar?
It''s quite normal that this has some impact on performance when it happens
too often.
Willy.



Hi, no I dont run it on an aux thread. Would doing this increase
performance wrt updating a prgbar?
Thanks

Andrew



"Andrew Bullock" <an*********************@ANDntlworldTHIS.com> wrote in
message news:7z*******************@newsfe7-gui.ntli.net...
| Willy Denoyette [MVP] wrote:
| > "Andrew Bullock" <an*********************@ANDntlworldTHIS.com> wrote in
| > message news:Dc*******************@newsfe7-win.ntli.net...
| > | Hi,
| > |
| > |
| > | I have a very processor intensive method, and I want to report its
| > | progress. When i get it to update a progressbar, label, print to
console
| > | etc. it vastly slows the method down.
| > |
| > | Is there a way to avoid this?
| > |
| > | Thanks
| > |
| > | Andrew
| >
| > I suppose you run this on an auxiliary thread, right?, How often do you
| > update the progress bar?
| > It''s quite normal that this has some impact on performance when it
happens
| > too often.
| >
| >
| > Willy.
| >
| >
|
| Hi, no I dont run it on an aux thread. Would doing this increase
| performance wrt updating a prgbar?
|

No, it won''t, but it keeps the UI responsive. Whenever you interrupt your
"processor bound" code path to update the UI it''s gonna hurt your
performance, unless you run this on a multi-core or HT CPU.
Willy.


这篇关于progressbars的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆