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 mce (Curate)
on Feb 04, 2003 at 15:33 UTC ( [id://232549]=note: print w/replies, xml ) Need Help??


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

Hi,

I am not an expert on memory mgmt, but I know there is such a thing as pseudo hashes, which are in fact just arrays, where the first item is a hash that performs the indexing.

They are not that flexible as normal hashes, but I think they have a large memory win against normal hashes (although I haven't tested this).

It is worth checking it out, espacially with the fields pragma.
---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium

  • 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 nothingmuch (Priest) on Feb 05, 2003 at 14:30 UTC
    Pseudo hashes are, as indicated by the adjective (?) 'pseudo', not really hashes.

    Pseudo hashes are a way of telling the compiler how to map keys to arrays, and translate all references to such keys, hard-coded (i think), into array indices. This allows easier building of staticly defined key sets for objects and configuration structures, etc, via the hash interface. The actual implementation is on an array, yielding lower memory requirements, and a speed increase. It's an array with a compile time overhead.

    -nuffin
    zz zZ Z Z #!perl

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2024-04-18 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found