Next | Making Programs Faster | 10 |
sort { -M $b <=> -M $a } readdir D;
@sorted_names = map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [ $_, -M $_ ] } readdir D;
-M and readdir consume mostly system time
Everything else is pure user time
The goal of the Schwartzian Transform is to reduce the number of -M's
But optimization is always a tradeoff
The cost is a lot more user-mode processing
We see this in the timing outputs
User Sys Total Direct 0.80 2.55 3.35 Schwartzian 1.14 0.39 1.53
The Schwartzian transform does 43% more processing
But it wins by asking the kernel for 84% less service
Next | Copyright © 2003 M. J. Dominus |