in reply to MLDBM slows down my script
MLDBM is bound to slow down your script somewhat, due to the nature of what it's doing for you (storing your multi-level datastructures on disk). If you read the WARNINGS section of the MLDBM doc, you'll see that it does matter how you access your MLDBM-tied hashes.
In particular, this means that instead of doing this:
for my $k (keys %{$h{something}}) { print $h{something}{$k}[0]{foo}{bar}; # FETCH _every_ time! }
.. you're better off doing this, to avoid FETCH-ing the top-level value every time:
my $root = $h{something}; # FETCH _once_ for my $k (keys %$root) { print $k->[0]{foo}{bar}; }
(Examples taken from MLDBM doc)
You might want to review your code for these kinds of situations.
HTH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: MLDBM slows down my script
by js1 (Monk) on Oct 30, 2003 at 16:29 UTC |