* Slow completion when using aptitude
@ 2011-01-17 9:51 cheer_xiao
2011-01-19 12:33 ` Richard Hartmann
0 siblings, 1 reply; 34+ messages in thread
From: cheer_xiao @ 2011-01-17 9:51 UTC (permalink / raw)
To: zsh-workers
Hi zsh users and hackers,
I'm running Ubuntu 10.04 on my box. I have found that tab-completion
for package names is slow when I use aptitude; however when I try
apt-get instead, the completion is almost instinct. I Google-ed and
found out that zsh switches to apt-cache policy for package name
completion some years ago, due to slow completion. I suspect that that
switch didn't take aptitude into concern, and it shouldn't be hard to
fix. Anyone willing to look into this? I'm using the version from git
repo.
And another small related issue: the command tab-completion of zsh
doesn't seem to know aptitude build-dep, which has been around for a
few years but (unfortunately) undocumented. The bash that comes with
Ubuntu knows this.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-17 9:51 Slow completion when using aptitude cheer_xiao
@ 2011-01-19 12:33 ` Richard Hartmann
2011-01-26 5:11 ` cheer_xiao
0 siblings, 1 reply; 34+ messages in thread
From: Richard Hartmann @ 2011-01-19 12:33 UTC (permalink / raw)
To: cheer_xiao; +Cc: zsh-workers
Hi,
those questions might be better suited to the -users list.
> And another small related issue: the command tab-completion of zsh
> doesn't seem to know aptitude build-dep, which has been around for a
> few years but (unfortunately) undocumented.
I did not have time to check the first issue, but on zsh 4.3.10, you
can complete to aptitude build-dep. As a general rule of thumb, please
try to use the newest version of zsh (and starting with zsh -f where
applicable/possible) before reporting issues. They might have been
fixed, already.
Richard
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-19 12:33 ` Richard Hartmann
@ 2011-01-26 5:11 ` cheer_xiao
2011-01-26 7:51 ` Julien Nicoulaud
0 siblings, 1 reply; 34+ messages in thread
From: cheer_xiao @ 2011-01-26 5:11 UTC (permalink / raw)
To: zsh-workers
On Wed, Jan 19, 2011 at 8:33 PM, Richard Hartmann
<richih.mailinglist@gmail.com> wrote:
> Hi,
>
> those questions might be better suited to the -users list.
>
>> And another small related issue: the command tab-completion of zsh
>> doesn't seem to know aptitude build-dep, which has been around for a
>> few years but (unfortunately) undocumented.
>
> I did not have time to check the first issue, but on zsh 4.3.10, you
> can complete to aptitude build-dep. As a general rule of thumb, please
> try to use the newest version of zsh (and starting with zsh -f where
> applicable/possible) before reporting issues. They might have been
> fixed, already.
Thanks for your attention. I posted this to zsh-workers because I
found it weird enough to be very likely a bug in source code. Could
you tell me if you are having performance problem with aptitude
tab-complete? Also, let me describe my problems in more detail.
If I type "sudo apt-get install a" and hit Tab, I only get a short
(yet noticeable) delay of about one second. But when I type "sudo
aptitude install a" and hit Tab, zsh freezes, one of the CPU cores get
100% loaded. It will recover after some 10 seconds. However after
this, the tab-completion of aptitude is as quick as apt-get's, until I
log out of zsh.
I am using the version from git repo:
xiaq@~> zsh --version
zsh 4.3.11-dev-1 (i686-pc-linux-gnu)
and my system:
xiaq@~> uname -a
Linux xxx 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC
2011 i686 GNU/Linux
After typing "sudo aptitude" and hitting Tab, the output is (build-dep
is absent):
xiaq@~> sudo aptitude
autoclean -- erase old downloaded package files
changelog -- view a package's changelog
clean -- erase downloaded package files
download -- download the .deb file for a package
forbid-version -- forbid aptitude from upgrading to a
specific package ve
forget-new -- forget what packages are "new"
full-upgrade -- perform an upgrade, possibly installing
and removing pa
hold -- place packages on hold
install -- install/upgrade packages
markauto -- mark packages as having been
automatically installed
purge -- remove packages and their configuration files
reinstall -- download and (possibly) reinstall a
currently installed
remove -- remove packages
safe-upgrade -- perform a safe upgrade
search -- search for a package by name and/or expression
show -- display detailed information about a package
unhold -- cancel a hold command for a package
unmarkauto -- mark packages as having been manually installed
update -- download lists of new/upgradable packages
why -- show the manually installed packages that
require a pac
why-not -- show the manually installed packages that
lead to a con
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-26 5:11 ` cheer_xiao
@ 2011-01-26 7:51 ` Julien Nicoulaud
2011-01-26 8:35 ` Frank Terbeck
0 siblings, 1 reply; 34+ messages in thread
From: Julien Nicoulaud @ 2011-01-26 7:51 UTC (permalink / raw)
To: cheer_xiao; +Cc: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 3245 bytes --]
Same here.
2011/1/26 cheer_xiao <xiaqqaix@gmail.com>
> On Wed, Jan 19, 2011 at 8:33 PM, Richard Hartmann
> <richih.mailinglist@gmail.com> wrote:
> > Hi,
> >
> > those questions might be better suited to the -users list.
> >
> >> And another small related issue: the command tab-completion of zsh
> >> doesn't seem to know aptitude build-dep, which has been around for a
> >> few years but (unfortunately) undocumented.
> >
> > I did not have time to check the first issue, but on zsh 4.3.10, you
> > can complete to aptitude build-dep. As a general rule of thumb, please
> > try to use the newest version of zsh (and starting with zsh -f where
> > applicable/possible) before reporting issues. They might have been
> > fixed, already.
>
> Thanks for your attention. I posted this to zsh-workers because I
> found it weird enough to be very likely a bug in source code. Could
> you tell me if you are having performance problem with aptitude
> tab-complete? Also, let me describe my problems in more detail.
>
> If I type "sudo apt-get install a" and hit Tab, I only get a short
> (yet noticeable) delay of about one second. But when I type "sudo
> aptitude install a" and hit Tab, zsh freezes, one of the CPU cores get
> 100% loaded. It will recover after some 10 seconds. However after
> this, the tab-completion of aptitude is as quick as apt-get's, until I
> log out of zsh.
>
> I am using the version from git repo:
>
> xiaq@~> zsh --version
> zsh 4.3.11-dev-1 (i686-pc-linux-gnu)
>
> and my system:
>
> xiaq@~> uname -a
> Linux xxx 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC
> 2011 i686 GNU/Linux
>
> After typing "sudo aptitude" and hitting Tab, the output is (build-dep
> is absent):
>
> xiaq@~> sudo aptitude
> autoclean -- erase old downloaded package files
> changelog -- view a package's changelog
> clean -- erase downloaded package files
> download -- download the .deb file for a package
> forbid-version -- forbid aptitude from upgrading to a
> specific package ve
> forget-new -- forget what packages are "new"
> full-upgrade -- perform an upgrade, possibly installing
> and removing pa
> hold -- place packages on hold
> install -- install/upgrade packages
> markauto -- mark packages as having been
> automatically installed
> purge -- remove packages and their configuration files
> reinstall -- download and (possibly) reinstall a
> currently installed
> remove -- remove packages
> safe-upgrade -- perform a safe upgrade
> search -- search for a package by name and/or expression
> show -- display detailed information about a package
> unhold -- cancel a hold command for a package
> unmarkauto -- mark packages as having been manually
> installed
> update -- download lists of new/upgradable packages
> why -- show the manually installed packages that
> require a pac
> why-not -- show the manually installed packages that
> lead to a con
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-26 7:51 ` Julien Nicoulaud
@ 2011-01-26 8:35 ` Frank Terbeck
2011-01-26 14:21 ` cheer_xiao
0 siblings, 1 reply; 34+ messages in thread
From: Frank Terbeck @ 2011-01-26 8:35 UTC (permalink / raw)
To: Julien Nicoulaud; +Cc: cheer_xiao, zsh-workers
Julien Nicoulaud wrote:
> Same here.
+ Fullquote? :)
> 2011/1/26 cheer_xiao <xiaqqaix@gmail.com>
>
>> On Wed, Jan 19, 2011 at 8:33 PM, Richard Hartmann
>> <richih.mailinglist@gmail.com> wrote:
[...]
>> >> And another small related issue: the command tab-completion of zsh
>> >> doesn't seem to know aptitude build-dep, which has been around for a
>> >> few years but (unfortunately) undocumented.
[...]
It does know `build-dep' for a while now; it was first introduced here:
<http://www.zsh.org/mla/workers/2009/msg00193.html>
>> Thanks for your attention. I posted this to zsh-workers because I
>> found it weird enough to be very likely a bug in source code. Could
>> you tell me if you are having performance problem with aptitude
>> tab-complete? Also, let me describe my problems in more detail.
>>
>> If I type "sudo apt-get install a" and hit Tab, I only get a short
>> (yet noticeable) delay of about one second. But when I type "sudo
>> aptitude install a" and hit Tab, zsh freezes, one of the CPU cores get
>> 100% loaded. It will recover after some 10 seconds. However after
>> this, the tab-completion of aptitude is as quick as apt-get's, until I
>> log out of zsh.
_aptitude does more than _apt-get. If the second <tab> doesn't take as
long as the first, you probably got caching enabled via zstyle.
>> I am using the version from git repo:
>>
>> xiaq@~> zsh --version
>> zsh 4.3.11-dev-1 (i686-pc-linux-gnu)
>>
>> and my system:
>>
>> xiaq@~> uname -a
>> Linux xxx 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC
>> 2011 i686 GNU/Linux
>>
>> After typing "sudo aptitude" and hitting Tab, the output is (build-dep
>> is absent):
>>
>> xiaq@~> sudo aptitude
>> autoclean -- erase old downloaded package files
>> changelog -- view a package's changelog
My installation is also from the git repo:
[snip]
% uname -srm
Linux 2.6.32-5-686 i686
% print $ZSH_VERSION
4.3.11-dev-1
% print $ZSH_PATCHLEVEL
1.5174
% sudo aptitude <tab>
- aptitude command -
autoclean -- erase old downloaded package files.
build-dep -- install the build-dependencies of packages.
changelog -- view a package's changelog.
[snip]
Are you sure you don't have two competing versions of zsh installed?
Then it may be possible that "print $ZSH_VERSION" and "zsh --version"
would yield different results.
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-26 8:35 ` Frank Terbeck
@ 2011-01-26 14:21 ` cheer_xiao
2011-01-26 14:55 ` Frank Terbeck
0 siblings, 1 reply; 34+ messages in thread
From: cheer_xiao @ 2011-01-26 14:21 UTC (permalink / raw)
To: zsh-workers
On Wed, Jan 26, 2011 at 4:35 PM, Frank Terbeck <ft@bewatermyfriend.org> wrote:
> [snip]
> _aptitude does more than _apt-get. If the second <tab> doesn't take as
> long as the first, you probably got caching enabled via zstyle.
So the problem is, as I understand, the cache for apt-get is
persistent, while that of aptitude isn't. It seems that I have done
nothing special about them, and the following is a snippet of my
.zshrc:
# The following lines were added by compinstall
zstyle ':completion:*' file-sort name
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}'
'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' menu select=1
zstyle ':completion:*' select-prompt '%SScrolling active: current
selection at %p%s'
zstyle :compinstall filename '/home/xiaq/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
To make things more clear, I tried the following:
xiaq@~> zsh -f
xiaq@~> autoload -Uz compinit && compinit
to get a minimal zsh environment with tab-completion enabled. The
result is still the same.
> [snip]
> Are you sure you don't have two competing versions of zsh installed?
> Then it may be possible that "print $ZSH_VERSION" and "zsh --version"
> would yield different results.
I did install the version from Ubuntu repo, but now I have already removed it.
xiaq@~> which -a zsh
/usr/local/bin/zsh
Could you check whether "aptitude -h" on your system mentions
build-dep? That of my system (Ubuntu 10.04) doesn't; while apt-get
does:
xiaq@~> aptitude -h | grep build
[no result]
xiaq@~> apt-get | grep build
build-dep - Configure build-dependencies for source packages
I doubt whether zsh's tab-completion of aptitude's(and other
utilities') verbs works by looking at "aptitude -h" first to generate
the verbs list. If so, the problem should be considered a bug of
aptitude that ships with Ubuntu 10.04 instead of zsh. (This has been
confirmed, so this minor bug belongs to aptitude instead of zsh.)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-26 14:21 ` cheer_xiao
@ 2011-01-26 14:55 ` Frank Terbeck
2011-01-26 17:05 ` Bart Schaefer
0 siblings, 1 reply; 34+ messages in thread
From: Frank Terbeck @ 2011-01-26 14:55 UTC (permalink / raw)
To: cheer_xiao; +Cc: zsh-workers
cheer_xiao wrote:
> On Wed, Jan 26, 2011 at 4:35 PM, Frank Terbeck <ft@bewatermyfriend.org> wrote:
>> [snip]
>> _aptitude does more than _apt-get. If the second <tab> doesn't take as
>> long as the first, you probably got caching enabled via zstyle.
>
> So the problem is, as I understand, the cache for apt-get is
> persistent, while that of aptitude isn't.
[...]
The difference is, that "aptitude install <tab>" lists uninstalled
packages, whereas "apt-get install <tab>" simply lists all available
packages. The former, while being more appropriate, also takes more
work.
I must admit, that I'm not quite familiar with how compsys' caching is
implemented. I may be giving wrong pointers here. So I should better be
quiet.
>> [snip]
>> Are you sure you don't have two competing versions of zsh installed?
>> Then it may be possible that "print $ZSH_VERSION" and "zsh --version"
>> would yield different results.
[...]
> xiaq@~> aptitude -h | grep build
> [no result]
> xiaq@~> apt-get | grep build
> build-dep - Configure build-dependencies for source packages
>
>
> I doubt whether zsh's tab-completion of aptitude's(and other
> utilities') verbs works by looking at "aptitude -h" first to generate
> the verbs list. If so, the problem should be considered a bug of
> aptitude that ships with Ubuntu 10.04 instead of zsh. (This has been
> confirmed, so this minor bug belongs to aptitude instead of zsh.)
The aptitude completion *does* in fact look at "aptitude -h" to figure
out which sub-commands to offer. And my aptitude does include it in its
output. Are you sure that your aptitude supports `build-dep'? Because
its author claims the help message was updated the in the same version
the functionality was added:
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501998#10>
(Although I think I remember an aptitude that had `build-dep' and didn't
list it in -h output. But I'm not sure.)
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-26 14:55 ` Frank Terbeck
@ 2011-01-26 17:05 ` Bart Schaefer
2011-01-26 17:29 ` Bart Schaefer
0 siblings, 1 reply; 34+ messages in thread
From: Bart Schaefer @ 2011-01-26 17:05 UTC (permalink / raw)
To: cheer_xiao, zsh-workers
On Jan 26, 3:55pm, Frank Terbeck wrote:
} Subject: Re: Slow completion when using aptitude
}
} The difference is, that "aptitude install <tab>" lists uninstalled
} packages, whereas "apt-get install <tab>" simply lists all available
} packages. The former, while being more appropriate, also takes more
} work.
I tried this completion on a system that has neither aptitude nor
apt-get installed at all, so that I could limit the differences to
those attributable directly to the zsh completion system.
Comparing _complete_debug output for the two, the main difference
seems to be that _aptitude passes through _deb_packages repeatedly
if you have a matcher-list, while _apt makes only a single pass.
Both start out by looking at the DEBS_avail cache, but _aptititude
then goes on to examine the DEBS_installed cache as well, which
seems like a missed optimization in the case of this particular
sub-command word.
} I must admit, that I'm not quite familiar with how compsys' caching is
} implemented. I may be giving wrong pointers here. So I should better
} be quiet.
The caching appears to be identical in both cases, they're both going
through the standard mechanism; in fact even with the commands not
installed, if I repeat the aptitude completion and compare the
_complete_debug output, the (empty) cache is used and most of the
work done in _deb_packages on the first attempt is avoided.
If the cache doesn't seem to persist across session exit/restart, it
must have something to do with how cache validity is determined.
--
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-26 17:05 ` Bart Schaefer
@ 2011-01-26 17:29 ` Bart Schaefer
2011-01-30 2:49 ` cheer_xiao
0 siblings, 1 reply; 34+ messages in thread
From: Bart Schaefer @ 2011-01-26 17:29 UTC (permalink / raw)
To: cheer_xiao, zsh-workers
On Jan 26, 9:05am, Bart Schaefer wrote:
} Subject: Re: Slow completion when using aptitude
}
} Comparing _complete_debug output for the two, the main difference
} seems to be that _aptitude passes through _deb_packages repeatedly
} if you have a matcher-list, while _apt makes only a single pass.
Oh, forgot to mention -- the _apt completer, at least for apt-get,
seems to suffer from the common bug of returning 0 when it finds no
completions, fooling the higher layers into thinking it succeeded
but there's nothing to do rather than that it failed. Of course it
may be that this is the right thing in this case, and _aptitude is
instead buggy when it returns 1 in the same circumstance.
That's probably why the number of passes through _deb_packages differs.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-26 17:29 ` Bart Schaefer
@ 2011-01-30 2:49 ` cheer_xiao
2011-01-30 5:16 ` Bart Schaefer
0 siblings, 1 reply; 34+ messages in thread
From: cheer_xiao @ 2011-01-30 2:49 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 103 bytes --]
Anyone willing to look further into this issue and possibly come up with a
fix? A lot of thanks ahead.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-30 2:49 ` cheer_xiao
@ 2011-01-30 5:16 ` Bart Schaefer
2011-01-30 5:53 ` cheer_xiao
0 siblings, 1 reply; 34+ messages in thread
From: Bart Schaefer @ 2011-01-30 5:16 UTC (permalink / raw)
To: cheer_xiao, zsh-workers@zsh.org
On Jan 30, 10:49am, cheer_xiao wrote:
}
} Anyone willing to look further into this issue and possibly come up with a
} fix? A lot of thanks ahead.
As you're able to reproduce it ... from the manual:
When loaded, the zsh/zprof causes shell functions to be profiled.
The profiling results can be obtained with the zprof builtin command
made available by this module. There is no way to turn profiling off
other than unloading the module.
Load that module, run the slow completion, and get us some output from
the zprof command to look at. (Somebody else can fix the typo in
"the zsh/zprof causes".)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-30 5:16 ` Bart Schaefer
@ 2011-01-30 5:53 ` cheer_xiao
2011-01-30 7:15 ` Bart Schaefer
0 siblings, 1 reply; 34+ messages in thread
From: cheer_xiao @ 2011-01-30 5:53 UTC (permalink / raw)
To: Bart Schaefer, zsh-workers
On Sun, Jan 30, 2011 at 1:16 PM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Jan 30, 10:49am, cheer_xiao wrote:
> }
> } Anyone willing to look further into this issue and possibly come up with a
> } fix? A lot of thanks ahead.
>
> As you're able to reproduce it ... from the manual:
>
> When loaded, the zsh/zprof causes shell functions to be profiled.
> The profiling results can be obtained with the zprof builtin command
> made available by this module. There is no way to turn profiling off
> other than unloading the module.
>
> Load that module, run the slow completion, and get us some output from
> the zprof command to look at. (Somebody else can fix the typo in
> "the zsh/zprof causes".)
I check the documentation that apparently there is no instruction on
how to load modules. Any hints?
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-30 5:53 ` cheer_xiao
@ 2011-01-30 7:15 ` Bart Schaefer
2011-01-30 10:40 ` Julien Nicoulaud
2011-02-03 10:23 ` cheer_xiao
0 siblings, 2 replies; 34+ messages in thread
From: Bart Schaefer @ 2011-01-30 7:15 UTC (permalink / raw)
To: cheer_xiao, zsh-workers
On Jan 30, 1:53pm, cheer_xiao wrote:
}
} I check the documentation that apparently there is no instruction on
} how to load modules. Any hints?
zmodload zsh/zprof
The zmodload command ought to be cross-referenced from the "Zsh Modules"
section, but there is an index entry for "loading modules" that points
to zmodload.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-30 7:15 ` Bart Schaefer
@ 2011-01-30 10:40 ` Julien Nicoulaud
2011-01-30 10:51 ` Julien Nicoulaud
2011-02-03 10:23 ` cheer_xiao
1 sibling, 1 reply; 34+ messages in thread
From: Julien Nicoulaud @ 2011-01-30 10:40 UTC (permalink / raw)
To: Bart Schaefer; +Cc: cheer_xiao, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 691 bytes --]
Here is zprof after a "sudo apt-get install a<TAB>":
http://paste2.org/p/1219060
<http://paste2.org/p/1219060>And after a "sudo aptitude install a<TAB>":
http://paste2.org/p/1219061
<http://paste2.org/p/1219061>As you said earlier, all the time is spent in
_deb_packages_update_uninstalled...
2011/1/30 Bart Schaefer <schaefer@brasslantern.com>
> On Jan 30, 1:53pm, cheer_xiao wrote:
> }
> } I check the documentation that apparently there is no instruction on
> } how to load modules. Any hints?
>
> zmodload zsh/zprof
>
> The zmodload command ought to be cross-referenced from the "Zsh Modules"
> section, but there is an index entry for "loading modules" that points
> to zmodload.
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-30 10:40 ` Julien Nicoulaud
@ 2011-01-30 10:51 ` Julien Nicoulaud
2011-01-30 11:18 ` cheer_xiao
2011-01-31 0:02 ` Bart Schaefer
0 siblings, 2 replies; 34+ messages in thread
From: Julien Nicoulaud @ 2011-01-30 10:51 UTC (permalink / raw)
To: Bart Schaefer; +Cc: cheer_xiao, zsh-workers
[-- Attachment #1: Type: text/plain, Size: 872 bytes --]
By the way, this issue was already known:
http://www.zsh.org/mla/workers/2008/msg00930.html
2011/1/30 Julien Nicoulaud <julien.nicoulaud@gmail.com>
> Here is zprof after a "sudo apt-get install a<TAB>":
> http://paste2.org/p/1219060
> <http://paste2.org/p/1219060>And after a "sudo aptitude install a<TAB>":
> http://paste2.org/p/1219061
>
> <http://paste2.org/p/1219061>As you said earlier, all the time is spent
> in _deb_packages_update_uninstalled...
>
> 2011/1/30 Bart Schaefer <schaefer@brasslantern.com>
>
> On Jan 30, 1:53pm, cheer_xiao wrote:
>> }
>> } I check the documentation that apparently there is no instruction on
>> } how to load modules. Any hints?
>>
>> zmodload zsh/zprof
>>
>> The zmodload command ought to be cross-referenced from the "Zsh Modules"
>> section, but there is an index entry for "loading modules" that points
>> to zmodload.
>>
>
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-30 10:51 ` Julien Nicoulaud
@ 2011-01-30 11:18 ` cheer_xiao
2011-01-31 0:02 ` Bart Schaefer
1 sibling, 0 replies; 34+ messages in thread
From: cheer_xiao @ 2011-01-30 11:18 UTC (permalink / raw)
To: zsh-workers
By any means, the inconsistency of apt-get's and aptitude's behavior
should be a bug; either we make them all look for all packages - an
approach not correct enough but doesn't lag; or speed up the procedure
aptitude looks for available packages and apply it to apt-get too.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-30 10:51 ` Julien Nicoulaud
2011-01-30 11:18 ` cheer_xiao
@ 2011-01-31 0:02 ` Bart Schaefer
2011-02-03 10:21 ` cheer_xiao
1 sibling, 1 reply; 34+ messages in thread
From: Bart Schaefer @ 2011-01-31 0:02 UTC (permalink / raw)
To: Julien Nicoulaud; +Cc: cheer_xiao, zsh-workers
On Jan 30, 11:51am, Julien Nicoulaud wrote:
}
} By the way, this issue was already known:
} http://www.zsh.org/mla/workers/2008/msg00930.html
So ...
_deb_packages_update_avail uses the cache to populate an array variable
of the same name.
As does _deb_packages_update_installed.
Then _deb_packages_update_uninstalled constructs a massive glob pattern
from the results of the latter, and applies it as a filter against the
former, to set a variable _deb_packages_update_uninstalled.
Thereafter the value of _deb_packages_update_uninstalled is used rather
than go through that filter again, so it *is* caching. The disk cache
isn't used by _deb*_uninstalled because the files are all on the disk
already from the other two functions.
All the time is being spent building that glob pattern, and filtering.
So try using this instead:
_deb_packages_update_uninstalled () {
_deb_packages_update_avail
_deb_packages_update_installed
if (( ! $+_deb_packages_cache_uninstalled )); then
local avail
for avail in $_deb_packages_cache_avail
do
(( ${+_deb_packages_cache_installed[(r)$avail]} )) && continue
_deb_packages_cache_uninstalledr+=( $avail )
done
fi
cachevar=_deb_packages_cache_uninstalled
}
Sometimes the most zsh-ish way to do something isn't the most efficient
way to do it. It may even be still faster to replace the "for" loop
with:
_dep_packages_cache_uninstalled=(
$( print -l $_deb_packages_cache_avail |
fgrep -vf =(print -l $_deb_packages_cache_installed) )
)
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-01-31 0:02 ` Bart Schaefer
@ 2011-02-03 10:21 ` cheer_xiao
2011-02-03 14:56 ` Bart Schaefer
0 siblings, 1 reply; 34+ messages in thread
From: cheer_xiao @ 2011-02-03 10:21 UTC (permalink / raw)
To: Bart Schaefer, zsh-workers
On Mon, Jan 31, 2011 at 8:02 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Jan 30, 11:51am, Julien Nicoulaud wrote:
> }
> } By the way, this issue was already known:
> } http://www.zsh.org/mla/workers/2008/msg00930.html
>
> So ...
>
> _deb_packages_update_avail uses the cache to populate an array variable
> of the same name.
>
> As does _deb_packages_update_installed.
>
> Then _deb_packages_update_uninstalled constructs a massive glob pattern
> from the results of the latter, and applies it as a filter against the
> former, to set a variable _deb_packages_update_uninstalled.
>
> Thereafter the value of _deb_packages_update_uninstalled is used rather
> than go through that filter again, so it *is* caching. The disk cache
> isn't used by _deb*_uninstalled because the files are all on the disk
> already from the other two functions.
>
> All the time is being spent building that glob pattern, and filtering.
>
> So try using this instead:
>
> _deb_packages_update_uninstalled () {
> _deb_packages_update_avail
> _deb_packages_update_installed
> if (( ! $+_deb_packages_cache_uninstalled )); then
> local avail
> for avail in $_deb_packages_cache_avail
> do
> (( ${+_deb_packages_cache_installed[(r)$avail]} )) && continue
> _deb_packages_cache_uninstalledr+=( $avail )
> done
> fi
> cachevar=_deb_packages_cache_uninstalled
> }
Was I supposed to include this in my .zshrc and that would solve my
problem, or was it meant to be a hint for developers on fixing the
bug? I have tried the former but nothing seems to change.
>
> Sometimes the most zsh-ish way to do something isn't the most efficient
> way to do it. It may even be still faster to replace the "for" loop
> with:
>
> _dep_packages_cache_uninstalled=(
> $( print -l $_deb_packages_cache_avail |
> fgrep -vf =(print -l $_deb_packages_cache_installed) )
> )
>
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-02-03 10:21 ` cheer_xiao
@ 2011-02-03 14:56 ` Bart Schaefer
2011-02-04 3:24 ` cheer_xiao
[not found] ` <AANLkTinfzf6gM5Z83_+iQqkc+QVzGGKa3yqbPTa+Wm3A@mail.gmail.com>
0 siblings, 2 replies; 34+ messages in thread
From: Bart Schaefer @ 2011-02-03 14:56 UTC (permalink / raw)
To: cheer_xiao, zsh-workers
On Feb 3, 6:21pm, cheer_xiao wrote:
} Subject: Re: Slow completion when using aptitude
}
} On Mon, Jan 31, 2011 at 8:02 AM, Bart Schaefer
} <schaefer@brasslantern.com> wrote:
} >
} > So try using this instead:
} >
} > _deb_packages_update_uninstalled () {
} > _deb_packages_update_avail
} > _deb_packages_update_installed
} > if (( ! $+_deb_packages_cache_uninstalled )); then
} > local avail
} > for avail in $_deb_packages_cache_avail
} > do
} > (( ${+_deb_packages_cache_installed[(r)$avail]} )) && continue
} > _deb_packages_cache_uninstalledr+=( $avail )
} > done
} > fi
} > cachevar=_deb_packages_cache_uninstalled
} > }
}
} Was I supposed to include this in my .zshrc and that would solve my
} problem, or was it meant to be a hint for developers on fixing the
} bug? I have tried the former but nothing seems to change.
Sorry, I could have been more specific.
Putting it in your .zshrc is unlikely to work because it'll get
clobbered when the completion system autoloads the other _deb*
functions later.
You need to find the file ${^fpath}/_deb_packages and edit it
to replace _deb_packages_update_uninstalled with the above.
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-02-03 14:56 ` Bart Schaefer
@ 2011-02-04 3:24 ` cheer_xiao
[not found] ` <AANLkTinfzf6gM5Z83_+iQqkc+QVzGGKa3yqbPTa+Wm3A@mail.gmail.com>
1 sibling, 0 replies; 34+ messages in thread
From: cheer_xiao @ 2011-02-04 3:24 UTC (permalink / raw)
To: zsh-workers
On Thu, Feb 3, 2011 at 10:56 PM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Feb 3, 6:21pm, cheer_xiao wrote:
> } Subject: Re: Slow completion when using aptitude
> }
> } On Mon, Jan 31, 2011 at 8:02 AM, Bart Schaefer
> } <schaefer@brasslantern.com> wrote:
> } >
> } > So try using this instead:
> } >
> } > _deb_packages_update_uninstalled () {
> } > _deb_packages_update_avail
> } > _deb_packages_update_installed
> } > if (( ! $+_deb_packages_cache_uninstalled )); then
> } > local avail
> } > for avail in $_deb_packages_cache_avail
> } > do
> } > (( ${+_deb_packages_cache_installed[(r)$avail]} )) && continue
> } > _deb_packages_cache_uninstalledr+=( $avail )
> } > done
> } > fi
> } > cachevar=_deb_packages_cache_uninstalled
> } > }
> }
> } Was I supposed to include this in my .zshrc and that would solve my
> } problem, or was it meant to be a hint for developers on fixing the
> } bug? I have tried the former but nothing seems to change.
>
> Sorry, I could have been more specific.
>
> Putting it in your .zshrc is unlikely to work because it'll get
> clobbered when the completion system autoloads the other _deb*
> functions later.
>
> You need to find the file ${^fpath}/_deb_packages and edit it
> to replace _deb_packages_update_uninstalled with the above.
I tried this, but after typing "sudo aptitude install a" and hit Tab,
zsh seems to be trapped in an infinite loop, with one of the CPU cores
fully loaded. Should I turn on something else like caching, or is
there a flaw in the code you provided?
Thanks for your patience.
^ permalink raw reply [flat|nested] 34+ messages in thread
[parent not found: <AANLkTinfzf6gM5Z83_+iQqkc+QVzGGKa3yqbPTa+Wm3A@mail.gmail.com>]
* Re: Slow completion when using aptitude
2011-01-30 7:15 ` Bart Schaefer
2011-01-30 10:40 ` Julien Nicoulaud
@ 2011-02-03 10:23 ` cheer_xiao
2011-02-03 14:51 ` Bart Schaefer
1 sibling, 1 reply; 34+ messages in thread
From: cheer_xiao @ 2011-02-03 10:23 UTC (permalink / raw)
To: Bart Schaefer, zsh-workers
On Sun, Jan 30, 2011 at 3:15 PM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Jan 30, 1:53pm, cheer_xiao wrote:
> }
> } I check the documentation that apparently there is no instruction on
> } how to load modules. Any hints?
>
> zmodload zsh/zprof
>
> The zmodload command ought to be cross-referenced from the "Zsh Modules"
> section, but there is an index entry for "loading modules" that points
> to zmodload.
Um... Could the documentation maintainer fix this?
^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Slow completion when using aptitude
2011-02-03 10:23 ` cheer_xiao
@ 2011-02-03 14:51 ` Bart Schaefer
0 siblings, 0 replies; 34+ messages in thread
From: Bart Schaefer @ 2011-02-03 14:51 UTC (permalink / raw)
To: cheer_xiao, zsh-workers
On Feb 3, 6:23pm, cheer_xiao wrote:
} Subject: Re: Slow completion when using aptitude
}
} On Sun, Jan 30, 2011 at 3:15 PM, Bart Schaefer
} <schaefer@brasslantern.com> wrote:
} >
} > The zmodload command ought to be cross-referenced from the "Zsh Modules"
} > section, but there is an index entry for "loading modules" that points
} > to zmodload.
}
} Um... Could the documentation maintainer fix this?
At the moment we can't fix anything (in any meaningful way) because
SourceForge was hacked and has shut off access to our code repository
until they're sure they've secured everything. It's taking them a
lot longer than they predicted to get things back online.
ssh: connect to host zsh.cvs.sourceforge.net port 22: Connection refused
^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2011-02-05 18:41 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-17 9:51 Slow completion when using aptitude cheer_xiao
2011-01-19 12:33 ` Richard Hartmann
2011-01-26 5:11 ` cheer_xiao
2011-01-26 7:51 ` Julien Nicoulaud
2011-01-26 8:35 ` Frank Terbeck
2011-01-26 14:21 ` cheer_xiao
2011-01-26 14:55 ` Frank Terbeck
2011-01-26 17:05 ` Bart Schaefer
2011-01-26 17:29 ` Bart Schaefer
2011-01-30 2:49 ` cheer_xiao
2011-01-30 5:16 ` Bart Schaefer
2011-01-30 5:53 ` cheer_xiao
2011-01-30 7:15 ` Bart Schaefer
2011-01-30 10:40 ` Julien Nicoulaud
2011-01-30 10:51 ` Julien Nicoulaud
2011-01-30 11:18 ` cheer_xiao
2011-01-31 0:02 ` Bart Schaefer
2011-02-03 10:21 ` cheer_xiao
2011-02-03 14:56 ` Bart Schaefer
2011-02-04 3:24 ` cheer_xiao
[not found] ` <AANLkTinfzf6gM5Z83_+iQqkc+QVzGGKa3yqbPTa+Wm3A@mail.gmail.com>
[not found] ` <110203193315.ZM22047@torch.brasslantern.com>
2011-02-04 3:44 ` cheer_xiao
2011-02-04 3:48 ` cheer_xiao
2011-02-04 4:29 ` Bart Schaefer
2011-02-04 5:46 ` cheer_xiao
2011-02-04 15:04 ` Bart Schaefer
2011-02-05 9:13 ` cheer_xiao
[not found] ` <AANLkTinftiPPV-TtNU5DQ1+TV6Tb5P6AprBsRGdjoamB@mail.gmail.com>
2011-02-05 9:21 ` cheer_xiao
2011-02-05 9:30 ` cheer_xiao
2011-02-05 17:12 ` gi1242+zsh
2011-02-05 17:48 ` Bart Schaefer
2011-02-05 18:40 ` gi1242+zsh
2011-02-05 17:46 ` Bart Schaefer
2011-02-03 10:23 ` cheer_xiao
2011-02-03 14:51 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).