From: Robert Klemme on 6 Mar 2010 09:29 On 03/05/2010 09:59 PM, Joe Martin wrote: > Robert Klemme wrote: >> For this scenario a thread pool with fixed size seems sufficient. >> > > Very good. This works quite nicely as well. > > Just wondering, are there any performance benefits of using one method > over the other? Which other method are you referring to? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
From: Joe Martin on 8 Mar 2010 10:11 Caleb Clausen wrote: > Yes. Threads use memory (quite a lot of it, in fact). Mostly this goes > to the thread's stack. Limiting the number of threads saves quite a > bit of memory. I'm not sure there's any improvement in the amount of > cpu time either way, other than perhaps some fewer cache misses > resulting from using less memory. Thanks! I figured this was the case. -- Posted via http://www.ruby-forum.com/.
From: Joe Martin on 8 Mar 2010 10:14 Robert Klemme wrote: > Which other method are you referring to? Well my original thinking was to create a thread for every single item I pass to the program. Caleb answered this for me in that threads themselves are quite heavy, so it further leads me to go with your solution which creates a low number of threads and re-uses them until the queue is empty. It seems much more simple and effecient than my original plan. -- Posted via http://www.ruby-forum.com/.
From: Robert Klemme on 8 Mar 2010 10:40
2010/3/8 Joe Martin <jm202(a)yahoo.com>: > Robert Klemme wrote: >> Which other method are you referring to? > > Well my original thinking was to create a thread for every single item I > pass to the program. Caleb answered this for me in that threads > themselves are quite heavy, so it further leads me to go with your > solution which creates a low number of threads and re-uses them until > the queue is empty. It seems much more simple and effecient than my > original plan. Ah, OK. Then I was just confused because you had used the term "thread pool" in your original posting. That term is commonly use for exactly the type of solution I posted (fixed or at least limited number of threads which get their tasks from some form of queue). You probably weren't aware of this. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ |