Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Useful number of childs revisited

by karlgoethebier (Abbot)
on May 08, 2015 at 14:05 UTC ( [id://1126099]=note: print w/replies, xml ) Need Help??


in reply to Re: Useful number of childs revisited
in thread Useful number of childs revisited [SOLVED]

"Using '/tmp' as the temp directory is badly broken"

Thank you very much for the hint.

"...What's wrong with for my n (@numbers)..."

Nothing is wrong with it. But the iterator was significantly faster in the example in my OP.

Update: Please see also this bug

Update 2:

"...iterator was ... faster"

I thought this might be of interest:

karls-mac-mini:monks karl$ ./forker.pl numbers: 2000 processes: 4 fork: 31.1171970367432 for: 40.2419550418854

I used this code...

while(defined( my $number = $iterator->())) { $pm->start($number) and next; my $factorial = Math::BigInt->bfac($number); $pm->finish( 0, \$factorial ); } $pm->wait_all_children;

...vs. this:

for my $number (@numbers) { $pm->start($number) and next; my $factorial = Math::BigInt->bfac($number); $pm->finish( 0, \$factorial ); } $pm->wait_all_children;

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1126099]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-24 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found