From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20639 invoked by alias); 4 Feb 2011 03:44:33 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28699 Received: (qmail 23067 invoked from network); 4 Feb 2011 03:44:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.210.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=+p5WOE/hyIOBdYi8eQ5I2eKJ3uXgpLVWM/u9mLMCzTs=; b=NzIt/SizFDcaLiFhBWjffNICFFSz/puiJZkkkAoKQNlYRne0KCsnctt2kUh1EpDFpw eecS5qK0MGb7ycpb+ijuzMz/hwDhcf527f9U2WPkctqXVXzF5NamEwYqogONf6IAys5g xrC5zmxqndAVuOQDNNTxW5mDTdVLKBdrbEg/c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=JVn0vGKjFbYdGXxf5zM7KYUn5TJ1gkvaFGNlbBGjYLYlKQ0xgqTFzz7RFyb6G7ISPA zOKT2HXVYqdHdyyNHAt9KRemBKrgtoBxZMmLsCKGFELHN5C1HNKl7pxShYD/24NPP5gv /wz7LFSOsYuj7BHMO1W/9gH6W6mqNekJuWO2Q= MIME-Version: 1.0 In-Reply-To: <110203193315.ZM22047@torch.brasslantern.com> References: <87oc74dpuy.fsf@ft.bewatermyfriend.org> <87d3njemu9.fsf@ft.bewatermyfriend.org> <110126090508.ZM2111@torch.brasslantern.com> <110126092944.ZM2205@torch.brasslantern.com> <110129211610.ZM21714@torch.brasslantern.com> <110129231514.ZM21967@torch.brasslantern.com> <110130160220.ZM15815@torch.brasslantern.com> <110203065608.ZM21224@torch.brasslantern.com> <110203193315.ZM22047@torch.brasslantern.com> From: cheer_xiao Date: Fri, 4 Feb 2011 11:44:07 +0800 Message-ID: Subject: Re: Slow completion when using aptitude To: Bart Schaefer , zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Feb 4, 2011 at 11:33 AM, Bart Schaefer wrote: > On Feb 4, 10:49am, cheer_xiao wrote: > } Subject: Re: Slow completion when using aptitude > } > } > } > _deb_packages_update_uninstalled () { > } > } > =C2=A0_deb_packages_update_avail > } > } > =C2=A0_deb_packages_update_installed > } > } > =C2=A0if (( ! $+_deb_packages_cache_uninstalled )); then > } > } > =C2=A0 =C2=A0local avail > } > } > =C2=A0 =C2=A0for avail in $_deb_packages_cache_avail > } > } > =C2=A0 =C2=A0do > } > } > =C2=A0 =C2=A0 =C2=A0 =C2=A0(( ${+_deb_packages_cache_installed[(r= )$avail]} )) && continue > } > } > =C2=A0 =C2=A0 =C2=A0 =C2=A0_deb_packages_cache_uninstalledr+=3D( = $avail ) > } > } > =C2=A0 =C2=A0done > } > } > =C2=A0fi > } > } > =C2=A0cachevar=3D_deb_packages_cache_uninstalled > } > } > } > } > > } > 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? > > It's probably still doing too much incremental memory allocation when > growing the _deb_*_uninstalled array, if there are many thousands of > packages either installed or available. > > Try the other way I suggested: > > _deb_packages_update_uninstalled () { > =C2=A0_deb_packages_update_avail > =C2=A0_deb_packages_update_installed > =C2=A0if (( ! $+_deb_packages_cache_uninstalled )); then > =C2=A0 =C2=A0_dep_packages_cache_uninstalled=3D( > =C2=A0 =C2=A0 =C2=A0$( print -l $_deb_packages_cache_avail | > =C2=A0 =C2=A0 =C2=A0 =C2=A0 fgrep -vf =3D(print -l $_deb_packages_cache_i= nstalled) Seems you have missed a closing parenthesis at the end of line. > =C2=A0 =C2=A0) > =C2=A0fi > } > It's a wonderful fix. zsh now respond within 2 seconds. Thanks a lot! I wish to see the fix committed into the source repo ASAP. Also the completion for apt-get should behave the same.