question about the nature of DBM ties
Peter Scott
Peter at PSDT.com
Wed Sep 25 17:12:08 CDT 2002
At 01:09 PM 9/24/2002 -0700, nkuipers wrote:
>When you tie a data structure to an external file, is populating that
>structure for large input updating directly into the file or is it crowding
>more and more stuff into memory which then gets dumped into the file, or what?
> In other words, does tying in this manner free up more RAM? The bottleneck
>in my code is the unique function but this function is necessary. All in all
>the code works perfectly but takes too long.
I'm in the middle of an exercise break for my students, so I don't have
long, but one thing I will suggest you check for is constructs which
vitiate the use of tie. For instance,
keys %tied_hash
makes the tie-ing pointless since it constructs the list of all the keys in
memory. Look for the use of any lists like these:
keys %hash
values %hash
%hash in list context
and get rid of them. Use only each() for iterating through the hash.
Peter Scott
peter at psdt.com
http://www.perldebugged.com
More information about the Victoria-pm
mailing list