Next Making Programs Faster 110

Vanity, Vanity, all is Vanity

Why do people bother to use the Schwartzian Transform?

        # Schwartzian Transform
        @sorted = map { $_->[0] } 
                  sort { $b->[1] <=> $a->[1] }
                  map { [ $_, -M $_ ] } @files;
        # Alternative
        { my %date;
          $date{$_} = -M $_ for @files;
          @sorted = sort { $date{$b} <=> $date{$a} } @files;
          undef %date;
        }
        NULL:   0.00u   0.00s   0.00total
        ST:     8.73u   1.48s  10.21total
        Hash:   9.59u   1.63s  11.22total

Next Copyright © 2003 M. J. Dominus