Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Useful number of childs revisited

by RichardK (Parson)
on May 08, 2015 at 13:55 UTC ( [id://1126095]=note: print w/replies, xml ) Need Help??


in reply to Useful number of childs revisited [SOLVED]

Using '/tmp' as the temp directory is badly broken on my machine. It spits lots of errors when exiting, and is trying to delete things that it doesn't own!

So I change it to this :-

mkdir '/tmp/1126078'; my $tmp = q(/tmp/1126078);

and now there's no significant difference between the 2 runs. But other than that, my guess is that you're just not doing enough real work, and you're only measuring setup/teardown times.

BTW I also got rid of the pointless iterator -- mainly because it's not installed here. What's wrong with for my n (@numbers) anyway?

Replies are listed 'Best First'.
Re^2: Useful number of childs revisited
by karlgoethebier (Abbot) on May 08, 2015 at 14:05 UTC
    "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»

Re^2: Useful number of childs revisited
by Anonymous Monk on May 08, 2015 at 17:22 UTC

    Using '/tmp' as the temp directory is badly broken on my machine.
    Sorry to hear that. Why not take it in for repairs?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-03-28 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found