zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: VCS_info seems really slow on remote filesystem
Date: Fri, 8 Nov 2019 10:24:46 +0000	[thread overview]
Message-ID: <20191108102446.w7vnufdrvy7hj7bp@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <CAH+w=7bhriPAtqr=dAwPhfiW45rX0SmxjyYwPMeXgjQiOX5rKw@mail.gmail.com>

Bart Schaefer wrote on Thu, Nov 07, 2019 at 19:41:13 -0800:
> After some fiddling around to enable function tracing I discovered
> that VCS_INFO_detect_git is trying two different "git rev-parse" calls
> and also looking for two subdirectories, and that
> VCS_INFO_git_getbranch is looking for five more directories and four
> files.  Those directory/file existence tsts are all slow operations on
> this filesystem, and in at least some of the cases appear to be tests
> that would only need to be done if the current directory changed?

The tests are also needed if a git command has been run from another shell.
For example, if you run «git checkout master» in one shell and then press
<Enter> on an empty command line in another shell, that other shell will
re-run vcs_info.

Is the check-for-changes style set?

> Is there anyone more familiar than I with the implementation than I,
> who could determine whether any of this information could be cached
> instead of being regenerated on every precmd?
> 

Possibly.  Question (to the list): Can we invalidate the cache automatically?
For example, could we avoid running all those file/directory existence tests in
VCS_INFO_git_getbranch unless the mtime of .git/<something> has changed since
the last call?  This way, we'd do fewer checks in all cases, not just in slow
mountpoints.

> (I've seen gitstatus recommended in another thread, but it's not
> feasible to install the binary daemon in the circumstances where I'm
> encountering this.)

As a last resort, you can set the disable-patterns style, but it disables
vcs_info completely for the directories it matches; even running vcs_info
interactively at the prompt won't bypass it.  (Arugably it should, though…)

  parent reply	other threads:[~2019-11-08 10:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08  3:41 Bart Schaefer
2019-11-08  4:00 ` Bart Schaefer
2019-11-08 10:24 ` Daniel Shahaf [this message]
2019-11-08 10:32 ` Roman Perepelitsa

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=20191108102446.w7vnufdrvy7hj7bp@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --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).