zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Slowness issue with git completion
Date: Tue, 26 Apr 2011 21:19:51 -0700	[thread overview]
Message-ID: <110426211951.ZM4200@torch.brasslantern.com> (raw)
In-Reply-To: <BANLkTikLMKZmCAxt=Ac-t-R_ZccZMt3pqg@mail.gmail.com>

Having just watched the CentOS mailing list descend into a morass of
increasingly snarky complaints and increasingly hostile and defensive 
responses, I'd really prefer not to have that happen here.

Suggested improvements are welcome.

Implemented improvements are even more welcome.

Assuming that the lack of any particular improvement is due to anything
other than a lack of either man-hours or of the expertise to devote to
making it, is probably misguided.  Getting offended about that to the
point of saying "if you don't like it, go elsewhere" is also misguided.

With that out of the way:

Specifically with respect to completion functions, it's true that there
has been a tendency to take the concept of "context-sensitivity" to an
extreme.  Quite a few completion functions go to considerable lengths
to not just suggest possible correct answers but to avoid suggesting
any incorrect answers.  Often this introduces inefficiency (cf. the
recent change to _deb_packages, workers/28710).

As was suggested in the _deb_packages thread, a good place to start if
you aren't able to implement an efficiency improvement yourself is to
find the slow code path with the zprof module.  I see someone did that
back in workers/28682 but the paste2.org reference has expired.  I
suspect, though, that as with _deb_packages the answer has little to
do with the way the starting set of files is chosen and everything to
do with zsh's parameter manipulation syntax being too grotty for a
large number of complex string manipulations.

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.


  parent reply	other threads:[~2011-04-27  4:20 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 18:26 Felipe Contreras
2011-04-26 18:43 ` Frank Terbeck
2011-04-26 19:06   ` Nikolai Weibull
2011-04-26 20:10     ` Frank Terbeck
2011-04-26 20:23   ` Felipe Contreras
2011-04-26 20:34     ` Mikael Magnusson
2011-04-26 20:57       ` Felipe Contreras
2011-04-26 20:59         ` Mikael Magnusson
2011-04-26 21:10           ` Felipe Contreras
2011-04-26 21:13             ` Mikael Magnusson
2011-04-26 21:35               ` Felipe Contreras
2011-04-26 22:03                 ` Nikolai Weibull
2011-04-26 22:25                   ` Felipe Contreras
2011-04-26 23:14                     ` Benjamin R. Haskell
2011-04-27  7:01                       ` Benjamin R. Haskell
2011-04-27  1:52                     ` gi1242+zsh
2011-04-27  6:11                     ` Nikolai Weibull
2011-04-27  8:30                       ` Felipe Contreras
2011-04-27  8:47                         ` Frank Terbeck
2011-04-27  9:06                           ` Felipe Contreras
2011-04-27 10:15                         ` Nikolai Weibull
2011-04-27 10:42                           ` Felipe Contreras
2011-04-27 11:14                             ` Nikolai Weibull
2011-04-27  4:19                 ` Bart Schaefer [this message]
2011-04-27  6:13                   ` Nikolai Weibull
2011-04-27 12:51                   ` Nikolai Weibull
2011-04-27 14:55                     ` Bart Schaefer
2011-04-27 18:36                       ` Nikolai Weibull
2011-04-30 14:37                     ` Simon Ruderich
2011-04-30 15:00                       ` Simon Ruderich
2011-05-02  9:59                       ` Nikolai Weibull
2011-05-03 13:59                         ` Nikolai Weibull
2011-04-26 21:52         ` Benjamin R. Haskell
2011-04-26 22:04           ` Felipe Contreras
2011-04-26 22:35             ` Benjamin R. Haskell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110426211951.ZM4200@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).