Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Slowness issue with git completion
- X-seq: zsh-workers 29091
- From: Nikolai Weibull <now@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Slowness issue with git completion
- Date: Wed, 27 Apr 2011 14:51:05 +0200
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=zMWNatZJZbiI+50QoqISKMUF3bp5ALOE87cEPgeUGhM=; b=PKDRQAxQy5/QuzA6/WcAZ/4r8gcLXOsUtQny0b2c6pKBeSs5Y/Qfq7CXHBoedfwkLD /Jh5aB8EMZclk/JCGMNJwwAGjGFNMsXaDFHiD/bxMTdj2zYPpP2YjDpO0EjHl9g4/7Cf yWNyFKU4O2/4nAR4llscS2rWEgSUADsC+OzRY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=EfmNVwM20yRKLAD4Jk6lF+PVOvSZpyp8FBEE7rRMlCavJ/BVCGiMcYNcfNeU/6vkwm pzJdA9OCQQp5iFyBopAG/UdaTsInD4tTPqHjNnRENuwuddohBz5rf9/gQ2rjds84rZhe Kk6Vp42GBXksCvDN1O6G0/+jj/c61t60Nmpfw=
- In-reply-to: <110426211951.ZM4200@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <BANLkTinKo=W8umz=JfneD3MNYdmv=xYhFQ@mail.gmail.com> <87liyw7t0o.fsf@ft.bewatermyfriend.org> <BANLkTim6WJWCrfLokA045Sc8su8DMXnKNw@mail.gmail.com> <BANLkTi=eLWad_TB4L=chD=3Fb_Pd9AQyqQ@mail.gmail.com> <BANLkTi=PrLsikjVhA-e06gjEkkxDpsdVaw@mail.gmail.com> <BANLkTi=N0DjXbf70LCo422DQ_2b0_dK_AQ@mail.gmail.com> <BANLkTikwk=OUQ7TzQB6FNcD2wztj+LHOGw@mail.gmail.com> <BANLkTinadx+av3XhHrdem8aNqp=k7Gm69Q@mail.gmail.com> <BANLkTikLMKZmCAxt=Ac-t-R_ZccZMt3pqg@mail.gmail.com> <110426211951.ZM4200@torch.brasslantern.com>
- Sender: nikolai.weibull@xxxxxxxxx
On Wed, Apr 27, 2011 at 06:19, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Also as someone noted elsewhere, zsh isn't very efficient at doing
> array appends or slices. Both complex string manipulations and lots
> of array slicing/appending are done in __git_files_relative which is
> called from _git_files. Not only that, but it does string ops on the
> path prefix on every pass around the "for file in $rawfiles" loop;
> that at least could be abstracted.
>
> I suspect that if someone undertook to rewrite __git_files_relative
> wholly or partly in something like sed or awk, the whole thing would
> be down to ~2 seconds even for a large number of files. Heck, even
> redoing the nested loops to do one multi-element array slice each
> instead of many single-element splices might make a huge difference.
Let’s instead remove it.
The attached patch seems to speed up matching a lot, while maintaining
all functionality. There might be cases that I haven’t considered.
Please review.
Another adjustment is that we could join the calls to git rev-parse
into one call:
gitcdupandprefix=${$(_call_program git-cdup-and-prefix git rev-parse
--show-cdup --show-prefix 2>/dev/null)/$'\n'}
to decrease the fork count as well, which makes a difference on
Cygwin. This won’t be quite correct, however, as it won’t work for
prefixes with newlines in them. Git-rev-parse sadly doesn’t take the
-z option.
Also, Bart, supplying -f to _multi_parts here doesn’t seem to have any
effect on match highlighting. Directories are shown the same as
files. This was something I asked about a long time ago that we were
going to look at at a later date. Perhaps that date has come?
Attachment:
git.patch
Description: Binary data
Messages sorted by:
Reverse Date,
Date,
Thread,
Author