zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Romain Francoise <rfrancoise@debian.org>
Cc: zsh-workers@sunsite.dk, 468386@bugs.debian.org
Subject: Re: Bug#468386: zsh-beta: Slow command completion
Date: Sun, 02 Mar 2008 10:32:52 -0800	[thread overview]
Message-ID: <080302103252.ZM11919@torch.brasslantern.com> (raw)
In-Reply-To: <87bq5xupu3.fsf@elegiac.orebokech.com>

On Mar 2,  4:07pm, Romain Francoise wrote:
}
} Which suggests that most of the time is spent building the arrays
} fed to compadd and/or formatting $descs w/ zformat.  AIUI, before
} your change for 24570 most of the contents of $commands were being
} thrown away, and it's no longer the case.

That's correct.  Before 24570 *all* of the contents of $commands were
being thrown away in some circumstances.  You get a choice between
slow and correct or fast and worthless.

After Clint's 24650 you can also have fast and correct but less helpful
(if the command descriptions really were helpful to begin with).

It belatedly occurs to me that the following might work as a replacement
for ${(k)commands[(I)$PREFIX]} and speed things up, except on the very
first call when the cache is populating (which may take a very long time).

--- ../zsh-forge/current/Completion/Unix/Type/_path_commands	2008-03-02 09:57:33.000000000 -0800
+++ Completion/Unix/Type/_path_commands	2008-03-02 10:10:54.000000000 -0800
@@ -50,9 +50,10 @@
 fi
 
 if [[ -n $need_desc ]]; then
-  typeset -a dcmds descs cmds
+  typeset -a dcmds descs cmds matches
   local desc cmd sep
-  for cmd in ${(k)commands}; do
+  compadd "$@" -O matches -k commands
+  for cmd in $matches; do
     desc=$_command_descriptions[$cmd]
     if [[ -z $desc ]]; then
       cmds+=$cmd


  reply	other threads:[~2008-03-02 18:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87zltldnde.fsf@elegiac.orebokech.com>
2008-02-28 17:27 ` Clint Adams
2008-02-28 17:54   ` Bart Schaefer
2008-03-02 15:07     ` Romain Francoise
2008-03-02 18:32       ` Bart Schaefer [this message]
2008-03-02 19:29         ` Romain Francoise
2008-03-02 20:52           ` Bart Schaefer
2008-03-02 21:46             ` Clint Adams
2008-03-02 22:45               ` Bart Schaefer
2008-03-02 23:02                 ` Clint Adams
2008-03-03  1:24                   ` Bart Schaefer
2008-03-03 15:46                     ` Oliver Kiddle
2008-02-28 17:54   ` Peter Stephenson
2008-02-28 18:24     ` Clint Adams
2008-02-29  1:11       ` Bart Schaefer
2008-02-29  2:07         ` Clint Adams
2008-02-29 17:12           ` Bart Schaefer
2008-03-01 23:06             ` Clint Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=080302103252.ZM11919@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=468386@bugs.debian.org \
    --cc=rfrancoise@debian.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).