From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26035 invoked from network); 13 Oct 2008 15:06:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Oct 2008 15:06:04 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 87044 invoked from network); 13 Oct 2008 15:05:50 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Oct 2008 15:05:50 -0000 Received: (qmail 7001 invoked by alias); 13 Oct 2008 15:05:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25876 Received: (qmail 6977 invoked from network); 13 Oct 2008 15:05:35 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 13 Oct 2008 15:05:35 -0000 Received: from mx2.mirz.uni-jena.de (mx2.mirz.uni-jena.de [141.35.15.234]) by bifrost.dotsrc.org (Postfix) with ESMTP id 1227080524C0 for ; Mon, 13 Oct 2008 17:05:25 +0200 (CEST) Received: from pax08e3.mipool.uni-jena.de (pax08e3.mipool.uni-jena.de [141.35.13.46]) by mx2.mirz.uni-jena.de (Postfix) with ESMTP id 0E42058005 for ; Mon, 13 Oct 2008 17:05:25 +0200 (CEST) Received: from informatik.uni-jena.de (ppc214.mipool.uni-jena.de [141.35.13.114]) by pax08e3.mipool.uni-jena.de (8.13.8/8.13.8) with SMTP id m9DF5Bt4418644 for ; Mon, 13 Oct 2008 17:05:12 +0200 (CEST) Received: by informatik.uni-jena.de (sSMTP sendmail emulation); Mon, 13 Oct 2008 17:05:11 +0200 Date: Mon, 13 Oct 2008 17:01:20 +0200 From: =?iso-8859-1?Q?J=F6rg?= Sommer To: zsh-workers@sunsite.dk Subject: Re: [PATCH] Re: git completion is really slow for some git commands. Message-ID: <20081013150120.GA16647@alea.gnuu.de> References: <1223557300.563.31.camel@localhost.localdomain> <1223885753.29462.7.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline In-Reply-To: <1223885753.29462.7.camel@localhost.localdomain> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV 0.92.1/8417/Mon Oct 13 09:34:29 2008 on bifrost X-Virus-Status: Clean --azLHFNyN32YCQGCU Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Brice, Brice Figureau schrieb am Mon 13. Oct, 10:15 (+0200): > On Mon, 2008-10-13 at 00:53 +0000, J=C3=B6rg Sommer wrote: > > > * this shell array is then passed to _multi_parts for path splitting= of > > > each element. This is this operation that takes age. As soon as I cha= nge > > > the _multi_parts code to just call a naive compadd and return, the > > > completion is (almost) immediate, and seems to work fine. > >=20 > > Can you try this patch? It doesn't change anything if you didn't specify > > anything, i.e. git log -- takes still very long. But it optimizes > > the case when you specify anything. Try git log -- some/thing. >=20 > [snipped patch] >=20 > Yes, that works way faster for this case. Unfortunately it doesn't seem > to report the right results: I've forgot to put the result back in an array. Try this patch: commit e8536069c36e8ae310e249356274a398bf5bd38d Author: J=C3=B6rg Sommer Date: Mon Oct 13 01:58:03 2008 +0200 Prefilter the completion for _multi_parts =20 The _multi_parts function consumes very much time, if the array with the possible completions is large. This happens often in large git repositories like the kernel git repository. To reduce the workload of _multi_parts filter out does entries from the array, they aren't possib= le completions. When the user specifies the path foo/bar only consider pat= hs matching the pattern foo*/bar*. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index c617613..b6f5297 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2761,6 +2761,7 @@ __git_files () { files=3D(${(ps:\0:)"$(_call_program files git ls-files -z $ls_opts $opts= 2>/dev/null)"}) __git_command_successful || return =20 + [[ -n $PREFIX ]] && files=3D(${(M)files:#${~PREFIX//\//*/}*}) _wanted files expl 'index file' _multi_parts $@ - / files } =20 @@ -2859,6 +2860,7 @@ __git_tree_files () { fi =20 local expl + [[ -n $PREFIX ]] && tree_files=3D(${(M)tree_files:#${~PREFIX//\//*/}*}) _wanted files expl 'tree file' _multi_parts -f $@ -- / tree_files } =20 Bye, J=C3=B6rg. --=20 Objektivit=C3=A4t ist die Wahnvorstellung, Beobachtungen k=C3=B6nnten ohne Beobachter gemacht werden =E2=80=93 Heinz v. Foerster --azLHFNyN32YCQGCU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkjzYr8ACgkQwe0mZwH1VIC7VwCfemUX1WnmIVm8JBUYAWhRT4tm wQ4AnjDR5PKBwRDINjWpGL+Z/LlyEsBz =0lUe -----END PGP SIGNATURE----- --azLHFNyN32YCQGCU--