Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: Using tie to initialize large datastructures

by da (Friar)
on Aug 08, 2001 at 20:54 UTC ( [id://103121]=note: print w/replies, xml ) Need Help??


in reply to Re: Using tie to initialize large datastructures
in thread Using tie to initialize large datastructures

I would like to add a second vote for use Memoize; your lookup functions are expensive and read-only, exactly what memoization is good for.

In addition to the behavior ariels mentions above, I'd like to point out it is easy to persistantly store the memoized data using tie, no muss, no fuss.

use DB_File; tie my %cache => 'DB_File', $filename, O_RDWR|O_CREAT, 0666; memoize 'function', SCALAR_CACHE => [HASH => \%cache];
In addition, Memoize makes a good profiler-- details are available here in Dominus's article.

___ -DA > perl -MPOSIX -e'$ENV{TZ}="US/Eastern";print ctime(10**9)' Sat Sep 8 21:46:40 2001

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-19 03:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found