There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Yes, because it uses an array, and only one array. What's even more important to me is that it's also decidely easier on memory. Every single array in Perl has a minimum overhead of about 100 bytes without even counting the individual scalars inside it (and the one holding the reference to it..). When you're trying to sort a couple dozen million elements with a Schwartzian transform, as I've had to, that adds up alarmingly. In comparison, this method is basically free in terms of memory cost. Nitpick: you should really say 0 .. $#h when that's what you mean, as is the case here. Makeshifts last the longest. In reply to Re^6: Benchmark, -s versus schwartzian (vs hash)
by Aristotle
|
|