Parallel-parallel_map
view release on metacpan or search on metacpan
lib/Parallel/parallel_map.pm view on Meta::CPAN
use Parallel::DataPipe;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(parallel_map);
our $INIT_DATA_PROCESSOR; # has to be code ref
sub parallel_map(&@) {
my ($code,@input) = @_;
my (@result,@output);
if (wantarray) {
@output = (output=>sub {my ($r,$i) = @_;$result[$i] = $r;});
}
Parallel::DataPipe::run {
input => \@input,
process => $code,
init_data_processor => $INIT_DATA_PROCESSOR, # this behaviour is introduced at 0.03
@output,
( run in 0.370 second using v1.01-cache-2.11-cpan-49f99fa48dc )