Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Code brewing for the upcoming MCE 10 year anniversary

by marioroy (Prior)
on Nov 11, 2022 at 12:15 UTC ( [id://11148140]=note: print w/replies, xml ) Need Help??


in reply to Re: Code brewing for the upcoming MCE 10 year anniversary
in thread Code brewing for the upcoming MCE 10 year anniversary

Update: Changed to "spawn" without the "_each" suffix. Thank you, choroba.

I updated the prior example. Seeing "spawneach" made me rename it to "spawn_each". I can leave out the "_each" suffix, but preferred to be clear that "spawn_each" will be spinning a child process per each element.

# serial code foreach my $i (30..38) { say "$$: $i"; } # this seems clear? spawn_each my $i (30..38) { say "$$: $i"; } # will this confuse folks? spawn my $i (30..38) { say "$$: $i"; }

Which one do you prefer (spawn_each, spawn) or something else? The "spawn" without the "_each" suffix is elegant, but wonder if folks will think not spawning a child process per element.

MCE::Simple is quite nice. It does not alter the line count when filtering / transposing to parallel code.

Replies are listed 'Best First'.
Re^3: Code brewing for the upcoming MCE 10 year anniversary
by 1nickt (Canon) on Nov 11, 2022 at 13:04 UTC

    Hi Mario

    Maybe spawn_for_each ... ?


    The way forward always starts with a minimal test.

      Yesterday, I had code supporting spawn foreach and for.

      spawn foreach my $i (30..38) { say "$$: $i"; } spawn for my $i (30..38) { say "$$: $i"; }

Log In?
Username:
Password:

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

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

    No recent polls found