Next Making Programs Faster 10

user time + system time = CPU time

Before

        sort { -M $b <=> -M $a } readdir D;

After

         @sorted_names = 
           map { $_->[0] }
           sort { $b->[1] <=> $a->[1] } 
           map { [ $_, -M $_ ] } 
           readdir D;
                      User   Sys  Total
              Direct  0.80  2.55   3.35
         Schwartzian  1.14  0.39   1.53

Next Copyright © 2003 M. J. Dominus