Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2 ptkdb 1.231 - patch for proximity window

closed-fixed
nobody
None
5
2012-04-17
2012-01-24
Mmarazzi
No

The proximity window may become a serious drawback while debugging
code which deals with large structures like array or hashes.
The point is that the proximity window always open the
structures up to the first level. This may take some time on flat arrays
with several thousand of items.
Of course, one may temporary switch off the window by means of menu option 'Data/Show Proximity Window'.

This patch solves this problem setting the depth on refresh to zero and resetting
them at the current real depth only when the user requests an expansion.

If you want to apply it, please do the following changes on module ptkdb.pm

1. Add this line

$Devel::ptkdb::proximityWindowInitialDepth = $ENV{'PTKDB_PROXIMITYWINDOWINITIALDEPTH'} || 0;

after the declaration of option '$Devel::ptkdb::showProximityWindow' (most likely line# 343).

2. Replace the following statement in the sub 'expr_expand_proximity'

$DB::window->refreshProximityWindow() ; # refresh the current content

with this line

$DB::window->refreshProximityWindow($depth) ; # refresh the current content

3. Replace the whole sub 'refreshProximityWindow' (most likely at line 1345) with this one:

sub refreshProximityWindow {
my $self = shift;
my ($depth) = @_;
$depth = $Devel::ptkdb::proximityWindowInitialDepth unless(defined $depth);
my $vars = $DB::window->{'proximity_expr_list'};
$self->deleteAllProximityExprs();
for (my $i=0; $i < @$vars; $i++) {
my $expr = $vars->[$i]->[0];
my @result= @{$vars->[$i]->[1]};
if (@result == 1) {
$self->insertExpr([ $result[0] ], $DB::window->{'proximity_data_list'}, $result[0], $expr, $depth) ; ## patch 24.01.2012/mam
} else {
$self->insertExpr([ \@result ], $DB::window->{'proximity_data_list'}, \@result, $expr, $depth) ; ## patch 24.01.2012/mam
}
} ;
return undef
}

Discussion

  • Mmarazzi
    Mmarazzi
    2012-04-17

    • status: open --> closed-fixed