Re: perl multithreading performance
- From: Leon Timmermans <fawaka@xxxxxxxxx>
- Date: 27 Aug 2008 20:39:53 GMT
On Wed, 27 Aug 2008 12:59:36 -0700, dniq00 wrote:
Everything works fine, HOWEVER! It's all so damn slow! It's only 10%
faster than single-process script, consumes about 2-3 times more memory
and about as much times more CPU.
I've also tried abandoning the Thread:Queue and just use threads::shared
with lock/cond_wait/cond_signal combination, without much success.
I've tried to play with $cpu_count and $buf_size, and found that after
$buf_size > 1000 doesn't make much difference, and $cpu_count > 2
actually makes things a lot worse.
Any ideas why in the world it's so slow? I did some research and
couldn't find a lot of info, other than the way I do it pretty much the
way it should be done, unless I'm missing something...
Hope anybody can enlighten me...
THANKS!
The speed of perl's threading is dependent on how much you share between
threads. Sharing the lines before processing them can become a
bottleneck, I suspect that's the problem in your case. You probably want
to divide the work first, and only used shared resources to report back
the results. Making a program scale over multiple processors isn't easy.
Sean O'Rourke entry in the wide finder benchmark (http://www.cs.ucsd.edu/
~sorourke/wf.pl) offers an interesting approach to this, though it isn't
exactly optimized for readability.
Regards,
Leon Timmermans
.
- Follow-Ups:
- Re: perl multithreading performance
- From: dniq00
- Re: perl multithreading performance
- References:
- perl multithreading performance
- From: dniq00
- perl multithreading performance
- Prev by Date: Truncate an array when you have a ref to it?
- Next by Date: Re: Truncate an array when you have a ref to it?
- Previous by thread: perl multithreading performance
- Next by thread: Re: perl multithreading performance
- Index(es):
Relevant Pages
|