From: Garance A Drosehn Date: 2005-07-17T08:37:55+09:00 Subject: Re: Cascading <=> comparisons On 7/16/05, Robert Klemme wrote: > Garance A Drosehn wrote: > > Noone explicitely commented on the use of hash.keys.sort: > this is quite inefficient. Instead doing the sort on the hash > directly is much more efficient: I can see how this would be faster wrt execution, but if I use hashobj.sort then I end up with an array of arrays which have both the key-names and their values. Memory-wise, isn't that going to be significantly larger than an array which only has the key-names? When I wrote this, I mainly thought about the memory usage, and I just assumed that the performance would be "about-the-same" either way... I'll check over my actual script wrt this idea. It's probably true that I would rather optimize the speed than the memory usage, in which case I might take advantage of this. I'll certainly use it in other scripts I write! Thanks. (note that in the actual script, the values are not simple integers, but objects which in turn have a lot of instance-variables...) -- Garance Alistair Drosehn = drosihn@gmail.com Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA