Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I have been thinking about the pros and cons of using hash or array.
So I made myself some data with a script approximating something like orbitals example, using the rand()-funktion on CD#, pdf-name, unknown digits in parenthesis and the different strings in brackets. The two approaches I've tested is either using a hash, straightforward and easy on the programmer, see my previous post. Or using an array and tucking the filepos to the right side, see petrals post. The tests were run on a measly Pentium 133 with 64MB RAM and the results are as of the table below(YMWV). The empty cells indicate heavy use of virtual memory.
My interpretation is that if you got the memory then the hash method is slightly faster, but using the array method will take you about twice as far in term of possibel file sizes. Thinking about it, it seems rather logical considering that the hash is both key and value whilst array is value only. It's also nice to see that both variations behave linearly with increasing volume until VM sets in, just as it's written in A Fresh Look at Efficient Perl Sorting by Uri Guttman and Larry Rosler. In reply to Re: Slow at sorting?
by guha
|
|