Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by Elian (Parson)
on Feb 03, 2003 at 20:23 UTC ( [id://232389]=note: print w/replies, xml ) Need Help??


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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://232389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (1)
As of 2024-04-25 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found