in reply to Hash of Arrays versus Two Hashes

Using parallel hashes has the advantages of

You pay the price for all those 2-element arrays. However, if the types of information you are going to store about each document is likely to extend, then there are rapidly diminishing returns from using parallel hashes.

By the time you get to 4 hashes -v- 1 hash of 4-element arrays, the penalty of duplicating the hash keys comes to bear with the former taking ~= 25MB and the latter ~= 30MB.

So it's easy to see that from the extensibility point of view, the HoA's comes out a winner pretty quickly and you should probably only consider the former if you're pretty certain that you won't need to extend and/or you're really up against it memory wise.


Examine what is said, not who speaks.

The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.