From d676104d7af44a1a768666b8ec999d9f26f95d9f Mon Sep 17 00:00:00 2001 From: "mahlon@laika.com" Date: Fri, 18 Feb 2011 02:00:54 +0000 Subject: [PATCH] Improve performance for cd/ls for containers with a large number of entries. Patch from Yann Cezard . FossilOrigin-Name: 873471574ca4aa3e01b9e0a30a151e9537bc4600938f61daa3c6c0c1dfef446b --- shelldap | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shelldap b/shelldap index 851af75..8b853d3 100755 --- a/shelldap +++ b/shelldap @@ -996,7 +996,7 @@ sub run_cd $self->base( $newbase ); # get new 'cwd' listing - my $s = $self->search({ scope => 'one' }); + my $s = $self->search({ scope => 'one', attrs => ['dn'] }); if ( $s->{'code'} ) { print "$s->{'message'}\n"; return; @@ -1398,6 +1398,7 @@ sub run_list my $self = shift; my @filters = @_; my $base = $self->base(); + my $attrs = [ 'dn', 'hasSubordinates' ]; # setup filters my ( $flags, $filter ); @@ -1415,13 +1416,16 @@ sub run_list if ( $flags ) { $recurse = $flags =~ /R/; $long = $flags =~ /l/; + if ($long) { + $attrs = [ '*', 'hasSubordinates' ]; + } } my $s = $self->search({ scope => $recurse ? 'sub' : 'one', vals => 1, filter => $filter, - attrs => [ '*', 'hasSubordinates' ] + attrs => $attrs }); if ( $s->{'code'} ) { print "$s->{'message'}\n";