Any faster way than a db file to store and retrieve hashes ?

David Cantrell david at
Mon Aug 7 22:38:39 BST 2006

On Mon, Aug 07, 2006 at 08:12:22PM +0200, Thomas Busch wrote:

> I have a hash table with roughly 1 millions keys. I am looking for
> the fastest way to store and retrieve this hash. After retrieval
> the hash should remain a normal perl hash and not be tied to anything.
> What's the best way to do this ? Is it Storable ?

Do you mean that you want to store and retrieve the entire hash in one
go, or that you want to store and retrieve individual entries?  I would
*guess* that Storable is faster in the first case, and some species of
DBM in the second.  Benchmarking will show you whether I guessed right.

Also note that DBMs don't properly store hashes with values which are
anything other than plain boring scalars, so no storing arrays or hashes
in your hash.  Unless you use MLDBM, which is quite disgustingly broken,
or DBM::Deep which is cool but not designed to be a speed demon.

And DBM::Deep isn't really a DBM anyway.

David Cantrell | A machine for turning tea into grumpiness

  There once a a tramp with "enable"
  Whose router used proprietary cables.
    When he got pissed on meths,
    He thought "screw IOS",
  "Let's apt-get install iptables"

More information about the mailing list