Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by Laurent_R (Canon)
on Apr 14, 2020 at 13:53 UTC ( #11115520=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ time perl collatz.pl
    837799: 525
    ...
    real    1m37,551s
    user    1m9,375s
    sys     0m21,031s
    
  2. or download this
    #!/usr/bin/perl
    use strict;
    ...
    
    @long_seqs = sort { $b->[1] <=> $a->[1]} @long_seqs;
    say  "$_->[0]: $_->[1]" for @long_seqs[0..19];
    
  3. or download this
    real    0m34,207s
    user    0m34,108s
    sys     0m0,124s
    
  4. or download this
    #!/usr/bin/perl
    use strict;
    ...
    
    @long_seqs = sort { $b->[1] <=> $a->[1]} @long_seqs;
    say  "$_->[0]: $_->[1]" for @long_seqs[0..19];
    
  5. or download this
    $ time perl collatz3.pl
    837799: 525
    ...
    real    0m1,755s
    user    0m1,687s
    sys     0m0,061s
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2020-09-30 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (156 votes). Check out past polls.

    Notices?