From: Dmitry Gutov <dmitry@gutov.dev>
To: Spencer Baugh <sbaugh@janestreet.com>, 66364@debbugs.gnu.org
Subject: bug#66364: 29.1.50; vc-hg-registered/state are slow on directories of large repos
Date: Thu, 5 Oct 2023 19:09:52 +0300 [thread overview]
Message-ID: <90fef338-cac6-aa08-bd74-5ce9e2721f76@gutov.dev> (raw)
In-Reply-To: <iermswx6pzr.fsf@janestreet.com>
On 05/10/2023 18:36, Spencer Baugh wrote:
> From 5573b678f816f81623deb7ebde66dfd3ebe92355 Mon Sep 17 00:00:00 2001
> From: Spencer Baugh<sbaugh@janestreet.com>
> Date: Thu, 5 Oct 2023 11:35:25 -0400
> Subject: [PATCH] Optimize vc-hg-state for directories
>
> Directories are never tracked in hg, so it's pointless to run
> vc-hg-state on them. And, in fact, our implementation previously
> would list all the files contained in the directory and then parse
> that in Emacs, which is very slow in large repos.
>
> Let's just use the knowledge that directories aren't tracked in hg,
> and skip running hg entirely.
>
> * lisp/vc/vc-hg.el (vc-hg-state): Return unregistered for directories.
> ---
> lisp/vc/vc-hg.el | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
> index c3e563a1f10..9a30706f519 100644
> --- a/lisp/vc/vc-hg.el
> +++ b/lisp/vc/vc-hg.el
> @@ -216,8 +216,10 @@ vc-hg-registered
>
> (defun vc-hg-state (file)
> "Hg-specific version of `vc-state'."
> - (let ((state (vc-hg-state-fast file)))
> - (if (eq state 'unsupported) (vc-hg-state-slow file) state)))
> + (if (file-directory-p file)
> + 'unregistered
> + (let ((state (vc-hg-state-fast file)))
> + (if (eq state 'unsupported) (vc-hg-state-slow file) state))))
>
> (defun vc-hg-state-slow (file)
> "Determine status of FILE by running hg."
Perhaps we should just follow the example of vc-git-registered and
return nil.
Could you mention which code calls 'registered' on a directory, though?
If it's in-tree, that's probably a bug too.
next prev parent reply other threads:[~2023-10-05 16:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 15:33 bug#66364: 29.1.50; vc-hg-registered/state are slow on directories of large repos Spencer Baugh
2023-10-05 15:36 ` Spencer Baugh
2023-10-05 16:09 ` Dmitry Gutov [this message]
2023-10-05 16:19 ` Spencer Baugh
2023-10-05 17:06 ` Dmitry Gutov
2023-10-13 1:09 ` sbaugh
2023-10-14 17:02 ` Dmitry Gutov
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90fef338-cac6-aa08-bd74-5ce9e2721f76@gutov.dev \
--to=dmitry@gutov.dev \
--cc=66364@debbugs.gnu.org \
--cc=sbaugh@janestreet.com \
/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.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).