| Next | Tricks of the Wizards | 125 |
@sorted_names =
map { $_->[0] }
sort { $b->[1] <=> $a->[1] }
map { [ $_, -M $_ ] }
readdir D;
Caveat: Do not optimize without benchmarking!
User System Total
5.11 + 6.83 = 11.94 Naive sort
7.37 + 0.82 = 8.19 Schwartzian transform
Donald E. Knuth (famous wizard) says (quoting R. W. Floyd):
Premature optimization is the root of all evil.
| Next | ![]() |
Copyright © 2003 M. J. Dominus |