August 1999 | Perl Hardware Store | Slide #33 |
You often want to speed up sort comparators
The slow part of this one is the calls to to_number:
sub compare_dates { to_number($a) <=> to_number($b); }
We replaced 17,500 calls to split with 17,500 calls to to_number
Instead of using Memoize, we'll inline the memoization, like this:
Next | Copyright © 1998 M-J. Dominus |