On 10/3/07, James <[EMAIL PROTECTED]> wrote:
>
> I have some code which creates a hash of arrays (HoA) then runs a 'while'
> loop, growing the HoA until x. So far the code works great but I have a data
> set I know will create a huge HoA and maybe eat up the memory.  It's 'skinny'
> data in terms of lots of 'keys' => a few array values each.  I'm happy with
> the data structure & methodology so what's a more efficient way of storing the
> data?
>
> Will a Tied hash help conserve memory when the HoA gets very large by writing
> to disk, and will it thus speed things up as it's not holding so much in
> memory? other suggestions?
snip

If the you are using enough memory to cause swapping/thrashing then a
tied hash is the right way to go; however, a normal dbm tied hash
cannot handle multiple levels of data (the A of your HoA will have to
be flattened to a string before storing).  You may want to look at the
MLDBM* module.

* http://search.cpan.org/dist/MLDBM/lib/MLDBM.pm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to