in reply to using parallel processing to concatenate a string, where order of concatenation doesn't matter
If Parallel::Queue's threading worked for me I'd suggest the following.
use threads::shared; use Parallel::Queue; print concatenate_parallel( ['a' .. 'z'], 4 ) . "\n"; sub concatenate_parallel { my $result :shared; my @input = map { my $string = $_; sub { $result .= $string; }; } @{ shift @_ }; my $max_threads = shift @_; my $mgr = Parallel::Queue->construct( 'thread' ); $mgr->runqueue( $max_threads, @input ); return $result; }
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using parallel processing to concatenate a string, where order of concatenation doesn't matter
by tphyahoo (Vicar) on Oct 18, 2006 at 14:26 UTC | |
by diotalevi (Canon) on Oct 18, 2006 at 15:52 UTC | |
by tphyahoo (Vicar) on Oct 20, 2006 at 17:40 UTC | |
by ikegami (Patriarch) on Oct 20, 2006 at 19:40 UTC | |
by diotalevi (Canon) on Oct 20, 2006 at 19:25 UTC |