Toffer's WebLog

A small place on the web for me to write about the adventures of my self education in coding

Using a ProgressBar control

 Hiya all.

I recenlty made a cheezy test program to just roll dice.  I put a ProgressBar control to show give the end user an idea of how many rolls are left.

Well, I noticed that when I tried to do 10000 consecutive rolls, the program slows waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay down.  When I had this all setup as a console app, it screamed no matter how many times I tried to roll the die.  I'm guessing this perf hit is because of the UI in general, but is there anything I can do to speed this up?  Is this something that someone would use threading on to improve perf?

Thanks in advance to anyone who answers.  :)

Published Saturday, January 28, 2006 4:05 PM by Toffer

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Dru said:

I would certainly use another thread. Have one thread handle the rolling of the dice and the other handle the UI.
January 28, 2006 7:40 PM
 

m.g said:

Be careful not to starve the UI thread. Read this for more information:

http://blogs.msdn.com/jfoscoding/archive/2005/10/30/487043.aspx
January 28, 2006 10:09 PM
 

Chris Szurgot said:

If you really expect it to scream through a lot of rolls, only update a percentage of the rolls (every 10, or every 100)... It'll still show enough progress to be meaningful.
January 29, 2006 11:04 AM
 

Matthew said:

Hard to say without seeing the code...
January 30, 2006 6:54 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker