Click here to Skip to main content
15,891,316 members
Home / Discussions / C#
   

C#

 
QuestionHow Do I Copy An Embedded Resource to a Directory? Pin
That Asian Guy19-Dec-08 14:19
That Asian Guy19-Dec-08 14:19 
AnswerRe: How Do I Copy An Embedded Resource to a Directory? Pin
N a v a n e e t h19-Dec-08 19:06
N a v a n e e t h19-Dec-08 19:06 
AnswerRe: How Do I Copy An Embedded Resource to a Directory? Pin
Giorgi Dalakishvili19-Dec-08 22:53
mentorGiorgi Dalakishvili19-Dec-08 22:53 
AnswerRe: How Do I Copy An Embedded Resource to a Directory? Pin
#realJSOP20-Dec-08 1:15
mve#realJSOP20-Dec-08 1:15 
QuestionHelp using Threads with an applications SDK [modified] Pin
__rob19-Dec-08 13:47
__rob19-Dec-08 13:47 
GeneralRe: Help using Threads with an applications SDK Pin
Luc Pattyn19-Dec-08 14:25
sitebuilderLuc Pattyn19-Dec-08 14:25 
GeneralRe: Help using Threads with an applications SDK [modified] Pin
__rob19-Dec-08 15:44
__rob19-Dec-08 15:44 
GeneralRe: Help using Threads with an applications SDK Pin
Luc Pattyn19-Dec-08 16:06
sitebuilderLuc Pattyn19-Dec-08 16:06 
I am not sure I understood it all correctly, but this is what I think I read:
- a method (GetUVFromPercentage) normally takes around 15msec to execute
- you want to take advantage of two cores, hence threading
- your code is intended to run numInstances threads in parallel
- your threaded code is much slower than the original, even with a single threadpool thread

I have three comments:
1. having lots of similar threads does not make sense to me; for identical jobs my advice is to keep the number of threads similar to the number of cores, and at most twice as much (when the jobs include heavy I/O operations); above that, threading overhead (switching all the time) will reduce the advantage rather than increase it. (Environment.ProcessorCount can be useful here).
2. having small jobs threaded (yours would be 15msec) is not wise; much better is to agglomerate smaller jobs into bigger jobs (a few seconds).
3. I typically try to have dynamic load balancing, i.e. rather than pushing jobs to threads, just push the jobs in a single queue, and have the threads pull their work from that queue, or something similar. That way, you will get best performance automatically. Of course this is more relevant when the jobs are dissimilar.

I am not sure my comments are sufficient to explain your observations. Getting a 300+ msec penalty just for using a threadpool thread seems steep.

What is the Port stuff you talked about? Any chance something else is also trying to use it?
Maybe that is a bottleneck, has a lock to support multi-thread access, and the lock (possibly a spin-lock) fails quite often??

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Fixturized forever. Confused | :confused:


QuestionParamter @ Model has no default value? Pin
dec8219-Dec-08 12:34
dec8219-Dec-08 12:34 
AnswerRe: Paramter @ Model has no default value? Pin
PIEBALDconsult19-Dec-08 12:45
mvePIEBALDconsult19-Dec-08 12:45 
QuestionWhat technique to use to keep my application running ... ? Pin
Yanshof19-Dec-08 11:45
Yanshof19-Dec-08 11:45 
AnswerRe: What technique to use to keep my application running ... ? Pin
Joel Ivory Johnson19-Dec-08 12:04
professionalJoel Ivory Johnson19-Dec-08 12:04 
GeneralRe: What technique to use to keep my application running ... ? Pin
Yanshof19-Dec-08 12:55
Yanshof19-Dec-08 12:55 
GeneralRe: What technique to use to keep my application running ... ? Pin
Colin Angus Mackay19-Dec-08 14:40
Colin Angus Mackay19-Dec-08 14:40 
AnswerRe: What technique to use to keep my application running ... ? Pin
Luc Pattyn19-Dec-08 13:12
sitebuilderLuc Pattyn19-Dec-08 13:12 
GeneralRe: What technique to use to keep my application running ... ? Pin
PIEBALDconsult19-Dec-08 13:30
mvePIEBALDconsult19-Dec-08 13:30 
GeneralRe: What technique to use to keep my application running ... ? Pin
Luc Pattyn19-Dec-08 13:48
sitebuilderLuc Pattyn19-Dec-08 13:48 
QuestionA form's minimum height Pin
Andrew Paul19-Dec-08 9:39
Andrew Paul19-Dec-08 9:39 
AnswerRe: A form's minimum height Pin
Dave Kreskowiak19-Dec-08 9:58
mveDave Kreskowiak19-Dec-08 9:58 
GeneralRe: A form's minimum height Pin
Andrew Paul19-Dec-08 10:27
Andrew Paul19-Dec-08 10:27 
GeneralRe: A form's minimum height Pin
Dave Kreskowiak19-Dec-08 15:48
mveDave Kreskowiak19-Dec-08 15:48 
GeneralRe: A form's minimum height Pin
Andrew Paul19-Dec-08 15:53
Andrew Paul19-Dec-08 15:53 
AnswerRe: A form's minimum height Pin
Luc Pattyn19-Dec-08 10:17
sitebuilderLuc Pattyn19-Dec-08 10:17 
GeneralRe: A form's minimum height Pin
Andrew Paul19-Dec-08 10:25
Andrew Paul19-Dec-08 10:25 
GeneralRe: A form's minimum height Pin
Luc Pattyn19-Dec-08 10:57
sitebuilderLuc Pattyn19-Dec-08 10:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.