whumann
unread,Apr 25, 2008, 11:29:50 AM4/25/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DBM-Deep
Disclaimer: I have a very weak understanding of what DBM:Deep does and
the following are observed very locally, without understanding what
reindex_entry() does in context.
I recently tried to use DBM::Deep for a big datastructure and observed
that during import it became slower and slower. I profiled the program
and found that the longer the program ran, the more time it spent in
reindex_entry(). Here's the code from version 1.0009:
sub reindex_entry {
my $self = shift;
my ($old_loc, $new_loc) = @_;
TRANS:
while ( my ($trans_id, $locs) = each %{ $self->{entries} } ) {
foreach my $orig_loc ( keys %{ $locs } ) {
if ( $orig_loc == $old_loc ) {
delete $locs->{orig_loc};
$locs->{$new_loc} = undef;
next TRANS;
}
}
}
}
I have two observations:
1.
delete $locs->{orig_loc};
should probably be
delete $locs->{$orig_loc};
so I expect that currently nothing gets deleted
2. I would expect that this part:
foreach my $orig_loc ( keys %{ $locs } ) {
if ( $orig_loc == $old_loc ) {
delete $locs->{orig_loc};
$locs->{$new_loc} = undef;
next TRANS;
}
}
might be replaced with this:
if ( exists $locs->{$old_loc} ) {
delete $locs->{$old_loc};
$locs->{$new_loc} = undef;
next TRANS;
}
This speeds up import() dramatically -- though still not enough for me
to test if anything gets broken, because the imort would still take
several days :-(
Comments appreciated!
Wolfram