Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by rjt (Curate)
on Apr 19, 2020 at 23:31 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11115813]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found