From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5827 invoked from network); 2 Mar 2008 18:33:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Mar 2008 18:33:20 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 8263 invoked from network); 2 Mar 2008 18:33:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Mar 2008 18:33:16 -0000 Received: (qmail 15034 invoked by alias); 2 Mar 2008 18:33:12 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24653 Received: (qmail 15008 invoked from network); 2 Mar 2008 18:33:11 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 2 Mar 2008 18:33:11 -0000 Received: from vms173001pub.verizon.net (vms173001pub.verizon.net [206.46.173.1]) by bifrost.dotsrc.org (Postfix) with ESMTP id 966848028C4E for ; Sun, 2 Mar 2008 19:33:07 +0100 (CET) Received: from torch.brasslantern.com ([71.121.18.67]) by vms173001.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JX4008008BBE293@vms173001.mailsrvcs.net> for zsh-workers@sunsite.dk; Sun, 02 Mar 2008 12:21:13 -0600 (CST) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id m22IWrPD011921; Sun, 02 Mar 2008 10:32:53 -0800 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m22IWqaC011920; Sun, 02 Mar 2008 10:32:52 -0800 Date: Sun, 02 Mar 2008 10:32:52 -0800 From: Bart Schaefer Subject: Re: Bug#468386: zsh-beta: Slow command completion In-reply-to: <87bq5xupu3.fsf@elegiac.orebokech.com> To: Romain Francoise Cc: zsh-workers@sunsite.dk, 468386@bugs.debian.org Message-id: <080302103252.ZM11919@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <87zltldnde.fsf@elegiac.orebokech.com> <20080228172715.GA12451@scowler.net> <080228095414.ZM15685@torch.brasslantern.com> <87bq5xupu3.fsf@elegiac.orebokech.com> Comments: In reply to Romain Francoise "Re: Bug#468386: zsh-beta: Slow command completion" (Mar 2, 4:07pm) X-Virus-Scanned: ClamAV 0.91.2/6078/Sun Mar 2 18:23:43 2008 on bifrost X-Virus-Status: Clean 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