Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Optimizing with Caching vs. Parallelizing (MCE::Map)

by rjt (Curate)
on Apr 19, 2020 at 23:31 UTC ( #11115813=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @seqlen = (-1,1);    # Memoize sequence length
    my $top    = 20;        # Report this many of the top sequences
    ...
    my $mintop = 0;         # Lowest value in @top
    
    GetOptions('top=i' => \$top, 'upper=i' => \$upper);
    
  2. or download this
    for (my $start = 3; $start < $upper; $start += 2) {
        my ($n, $len) = ($start, 0);
    ...
        top($start => $len)            if $len > $mintop  and     $start <
    += $upper;
        top($n * 2 => $seqlen[$n] + 1) if   $n < $upper/2 and $seqlen[$n] 
    +> $mintop;
    }
    
  3. or download this
    sub top {
        my ($n, $len) = @_;
    ...
        pop @top if @top > $top;
        $mintop = $top[-1][1];
    }
    
  4. or download this
    real    0m0.848s
    user    0m0.835s
    sys     0m0.012s
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-10-22 07:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (225 votes). Check out past polls.

    Notices?