in reply to A memory efficient hash, trading off speed - does it already exist?

You may find that a not-insignificant amount of the memory's being taken up by internal structure rather than extra preallocated space. SVs aren't small, and you've got a lot of pointers and pointers to pointers there. Not to mention hash key structs which are 8 bytes plus the key string, per key...

There's not much you're going to do to reduce in-memory costs, I think, without a lot of extra speed hit. Use a DB, as hasn been suggested--Berkeley DB or even a plain NDBM/GDBM file will probably serve you well here.

  • Comment on Re: A memory efficient hash, trading off speed - does it already exist?

Replies are listed 'Best First'.
Re: Re: A memory efficient hash, trading off speed - does it already exist?
by Elian (Parson) on Feb 07, 2003 at 17:26 UTC
    To reply to myself here... There's now Packed::Array for packed arrays. Not a hash, mind, but it might be useful to you in some circumstances. (Doing a packed hash would be rather more difficult, and haved much less of a memory win than packed arrays do)