Subject: Re: bug#42966: 28.0.50; vc-dir: wrong backend

From: Michael Albinus <[email-masked]>
Date: Sat, 24 Oct 2020 15:41:38 +0200

Dmitry Gutov <[email-masked]> writes:

> Hi Michael,

Hi Dmitry,

> Not in Tramp, but I see an old change in VC that was most likely
> informed by a performance problem in Tramp.
>
> See the commit a40c87a0093. It adds caching of the result of
> vc-git-root to a VC property 'git-root' on the file name.

This seems to be bug#11757.

> Does the change below still make some scenario perceptibly slower?
>
> diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
> index b1880c0f7b..91554bb6d8 100644
> --- a/lisp/vc/vc-git.el
> +++ b/lisp/vc/vc-git.el
> @@ -1573,8 +1573,7 @@ vc-git-extra-menu
>  (defun vc-git-extra-status-menu () vc-git-extra-menu-map)
>
>  (defun vc-git-root (file)
> -  (or (vc-file-getprop file 'git-root)
> -      (vc-file-setprop file 'git-root (vc-find-root file ".git"))))
> +  (vc-find-root file ".git"))
>
>  ;; grep-compute-defaults autoloads grep.
>  (declare-function grep-read-regexp "grep" ())

I haven't tested. But this means to call process-file several times,
it would be a performance degradation, for sure.

Best regards, Michael.