From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25518 invoked from network); 13 Oct 2008 15:45:52 -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.7 required=5.0 tests=AWL 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:45:52 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 251 invoked from network); 13 Oct 2008 15:45:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Oct 2008 15:45:39 -0000 Received: (qmail 19903 invoked by alias); 13 Oct 2008 15:45:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25878 Received: (qmail 19878 invoked from network); 13 Oct 2008 15:45:23 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 13 Oct 2008 15:45:23 -0000 Received: from mail.daysofwonder.com (mail.daysofwonder.com [87.98.213.69]) by bifrost.dotsrc.org (Postfix) with ESMTP id 382BA80524C2 for ; Mon, 13 Oct 2008 17:45:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.daysofwonder.com (Postfix) with ESMTP id 1D70C68088 for ; Mon, 13 Oct 2008 17:45:15 +0200 (CEST) X-Virus-Scanned: by amavisd-new at daysofwonder.com Received: from mail.daysofwonder.com ([127.0.0.1]) by localhost (mail.daysofwonder.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mkYpODbGzISt for ; Mon, 13 Oct 2008 17:45:07 +0200 (CEST) Received: from sc.dow-test.wanadoo.fr (dow.net8.nerim.net [213.41.185.138]) (Authenticated sender: brice) by mail.daysofwonder.com (Postfix) with ESMTPA id 32B3E68084 for ; Mon, 13 Oct 2008 17:45:07 +0200 (CEST) Subject: Re: [PATCH] Re: git completion is really slow for some git commands. From: Brice Figureau To: zsh-workers@sunsite.dk In-Reply-To: <20081013150120.GA16647@alea.gnuu.de> References: <1223557300.563.31.camel@localhost.localdomain> <1223885753.29462.7.camel@localhost.localdomain> <20081013150120.GA16647@alea.gnuu.de> Content-Type: text/plain Date: Mon, 13 Oct 2008 17:45:06 +0200 Message-Id: <1223912706.29462.40.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.92.1/8417/Mon Oct 13 09:34:29 2008 on bifrost X-Virus-Status: Clean On Mon, 2008-10-13 at 17:01 +0200, Jrg Sommer wrote: > Hello Brice, > > Brice Figureau schrieb am Mon 13. Oct, 10:15 (+0200): > > On Mon, 2008-10-13 at 00:53 +0000, Jrg 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 change > > > > the _multi_parts code to just call a naive compadd and return, the > > > > completion is (almost) immediate, and seems to work fine. > > > > > > 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. > > > > [snipped patch] > > > > 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: [snipped patch] Yes, this fixes the issue, and that's a good enhancement! Unfortunately if you have plenty of completion possibility under the same prefix, you hit again the root issue that is that _multi_part is pretty slow when fed with large arrays. I didn't had a look to _multi_part in detail yet but I think it is at least an O(n2) kind of algorithm. I'll try to have a look to the algorithm and see if maybe there is something that we can do for it. Thanks for you patch, I'm running with it now :-) -- Brice Figureau