diff --git a/Changes b/Changes index a592022..fc3c150 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,7 @@ Revision history for e ================= Added commands: max, min (from List::Util). +Added limit to number of processes with runf (currently set to 20). Updated pod. ================= diff --git a/README.md b/README.md index 5f9033e..4a55d47 100644 --- a/README.md +++ b/README.md @@ -553,6 +553,10 @@ This sector includes commands to run asynchronous It is not entirely clear which method to always use. +`runf` limits to number of action or 20 (whichever is smaller). + +`runt` and `runio` have no such limits. + Typically using threads (with `runt`) seems to be fastest. Some statistics using different run commands: @@ -603,6 +607,8 @@ Returns the results. Takes much overhead to start up! +Will use up to 20 processes. + ### runio Run tasks in parallel using [Mojo::IOLoop](https://metacpan.org/pod/Mojo%3A%3AIOLoop). diff --git a/lib/e.pm b/lib/e.pm index a70ae6d..111a65a 100644 --- a/lib/e.pm +++ b/lib/e.pm @@ -587,6 +587,10 @@ This sector includes commands to run asynchronous It is not entirely clear which method to always use. +C limits to number of action or 20 (whichever is smaller). + +C and C have no such limits. + Typically using threads (with C) seems to be fastest. Some statistics using different run commands: @@ -637,6 +641,8 @@ Returns the results. Takes much overhead to start up! +Will use up to 20 processes. + =head3 runio Run tasks in parallel using L. @@ -1128,7 +1134,9 @@ sub import { require Parallel::ForkManager; } - my $pm = Parallel::ForkManager->new( ~~ @_ ); + my $MAX_PROCESSES = 20; + my $processes = ( @_ > $MAX_PROCESSES ) ? $MAX_PROCESSES : @_; + my $pm = Parallel::ForkManager->new( $processes ); my @res; $pm->run_on_finish(