|
| |
User Groups : Forums : SiteExperts :
Microsoft .NET
:  | Threaded method maxing out processor Ok, I have an image resizer app that I wrote.
It's supposed to take images from a file location (mainly CD), resize them, and save them to my local drive.
I do this iteratively with a foreach loop.
Well, the application works, but not as optimally as I would like. The thread maxes out my CPU usage. As in 100%.
I'll post the code later, but any advice on how I can optimize performance?
I seem to be having a memory problem, too. If I do too many CDs or too many photos, I get an "out of memory" error, so I need to free up memory as we go.
Any thoughts or advice?Started By Monte on Oct 2, 2009 at 2:13:36 PM |  | | 5 Response(s) | Reply |
| Earlier Replies | Replies 1 to 5 of 5 | Later Replies |  | | Terry Young on Nov 12, 2009 at 8:59:41 AM (# 1) Thread.Priority perhaps?
http://msdn.microsoft.com/en-us/library/system.threading.thread.priority.aspx Terry Young on Nov 12, 2009 at 9:06:48 AM (# 2)Oh, and, dealing with multi core systems you can explore these keywords: thread affinity
Just some thoughts. Never had the opportunity to actually try those. Monte on Nov 12, 2009 at 9:55:18 AM (# 3)I haven't checked Thread.Priority.
Although I did add a half-second latency to the app by using Thread.Sleep(500) to the appropriate thread. That seems to have fixed the "out of memory" error... ChrisRickard on Nov 16, 2009 at 5:21:53 PM (# 4)If you're maxing out your processor adding more threads just adds more overhead. Most likely your resizing algorithm is the best place to looking at optimizing.
However I really couldn't say without looking at the code. Monte on Nov 18, 2009 at 4:36:47 AM (# 5)The app is really only two threads. The one for the UI, and the one that does the resize processing.
| | Earlier Replies | Replies 1 to 5 of 5 | Later Replies |
To respond to a discussion, you must first logon.
If you are not registered, please register yourself to become a member of the SiteExperts.community.
|