in reply to sort performance
(Read it bottom to top and it will make more sense.)my @sorted_keys = map {$_->[0]} sort {$a->[1] cmp $b->[1]} map {[$_, $hash{$_}{this}]} keys %hash;
This is more memory intensive, but doing the double lookup in the sort block means that it happens O(n * log(n)) times. Doing it in a map means it only happens n times. (Where n is the number of keys.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re (tilly) 1: sort performance
by runrig (Abbot) on Sep 12, 2000 at 04:45 UTC | |
by tilly (Archbishop) on Sep 12, 2000 at 05:59 UTC | |
by tye (Sage) on Sep 12, 2000 at 07:00 UTC | |
by tilly (Archbishop) on Sep 12, 2000 at 07:05 UTC | |
by tilly (Archbishop) on Sep 12, 2000 at 07:42 UTC | |
by tye (Sage) on Sep 12, 2000 at 08:01 UTC |