Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Sorting blocks and efficiency (in Re to Re: Algorithm::Treap)

by bart (Canon)
on Sep 08, 2003 at 09:23 UTC ( [id://289724]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      @sorted = sort { $a <=> $b } @list;
    
  2. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
        reversed_numerical => sub { @sorted = sort { $b <=> $a } @unsorted
    + },
        messed_up=> sub { @sorted = sort { my $cmp = $a <=> $b; $cmp } @un
    +sorted },
    });
    
  3. or download this
    Benchmark: running messed_up, native, numerical, reversed_numerical, r
    +eversed_string, string, each for at least 3 CPU seconds...
     messed_up:  3 wallclock secs ( 3.29 usr +  0.00 sys =  3.29 CPU) @ 75
    +.99/s (n=250)
    ...
    reversed_numerical:  2 wallclock secs ( 3.13 usr +  0.00 sys =  3.13 C
    +PU) @ 379.87/s (n=1189)
    reversed_string:  4 wallclock secs ( 3.62 usr +  0.00 sys =  3.62 CPU)
    + @ 239.78/s (n=868)
        string:  3 wallclock secs ( 3.24 usr +  0.00 sys =  3.24 CPU) @ 22
    +6.54/s (n=734)
    

Log In?
Username:
Password:

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

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

    No recent polls found