From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2219 invoked from network); 2 Mar 2008 15:22:52 -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=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 15:22:52 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 26117 invoked from network); 2 Mar 2008 15:22:43 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Mar 2008 15:22:43 -0000 Received: (qmail 9103 invoked by alias); 2 Mar 2008 15:22:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24652 Received: (qmail 29216 invoked from network); 2 Mar 2008 15:07:37 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 2 Mar 2008 15:07:37 -0000 Received: from smtp4-g19.free.fr (smtp4-g19.free.fr [212.27.42.30]) by bifrost.dotsrc.org (Postfix) with ESMTP id 36E0D8028C4F for ; Sun, 2 Mar 2008 16:07:33 +0100 (CET) Received: from smtp4-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp4-g19.free.fr (Postfix) with ESMTP id 353DF3EA0F0; Sun, 2 Mar 2008 16:07:33 +0100 (CET) Received: from elegiac.orebokech.com (home.orebokech.com [82.67.41.165]) by smtp4-g19.free.fr (Postfix) with ESMTP id 11EBE3EA0DC; Sun, 2 Mar 2008 16:07:32 +0100 (CET) Received: by elegiac.orebokech.com (Postfix, from userid 1000) id 21D343B2E9; Sun, 2 Mar 2008 16:07:32 +0100 (CET) From: Romain Francoise To: Bart Schaefer Cc: zsh-workers@sunsite.dk, 468386@bugs.debian.org Subject: Re: Bug#468386: zsh-beta: Slow command completion Organization: The Debian Project References: <87zltldnde.fsf@elegiac.orebokech.com> <20080228172715.GA12451@scowler.net> <080228095414.ZM15685@torch.brasslantern.com> Date: Sun, 02 Mar 2008 16:07:32 +0100 In-Reply-To: <080228095414.ZM15685@torch.brasslantern.com> (Bart Schaefer's message of "Thu, 28 Feb 2008 09:54:14 -0800") Message-ID: <87bq5xupu3.fsf@elegiac.orebokech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.91.2/6074/Sat Mar 1 22:59:36 2008 on bifrost X-Virus-Status: Clean Hi Bart, Bart Schaefer writes: > The workaround for Romain is probably to enable caching of the output > by creating a cache-policy style for :completion::complete:-command-:: > context. Even after enabling the cache it's still unbearably slow on my machine (_path_commands already defines a cache-policy style). Each completion takes about two seconds. oprofile reports the following: | CPU: Core 2, speed 1600 MHz (estimated) | Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with | a unit mask of 0x00 (Unhalted core cycles) count 100000 | samples % symbol name | 11356 31.2528 ztrdup | 5635 15.5080 zalloc | 3244 8.9278 .plt | 2766 7.6123 setarrvalue | 1942 5.3446 zhalloc | 1460 4.0181 arrlen | 1457 4.0098 freearray 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. It matters since the array is quite large, $commands has 3901 elements here, 2805 of which have descriptions: $ echo $#_command_descriptions 2805 $ stat -c %s ~/.zsh/command-descriptions 145962 $ -- Romain Francoise http://people.debian.org/~rfrancoise/