bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Dmitry Gutov
Subject: bug#42966: 28.0.50; vc-dir: wrong backend
Date: Sat, 24 Oct 2020 02:53:35 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Michael,

On 18.10.2020 10:38, Michael Albinus wrote:

I don't have a strong opinion on the remote performance, but we might
want to ask Michael. Looking at the code, it seems to have forced him
to unfortunate measures in the past (such as adding said caching to
vc-git-root).

I didn't follow the thread closely. Could you pls explain, what you find
unfortunate in Tramp, and how to fix it?

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.

There are a couple problems with that:

- If FILE is a directory, this cache will never be invalidated (for plain files, vc-file-clearprops is called from a number of functions, including vc-refresh-state).

- We don't do this for any other backends, which leads to inconsistencies in behavior, as well as surprising results, like when we did that performance test earlier. I think this is the reason for it.

If we did this uniformly for all backends, we could perhaps find better opportunities for caching and invalidation.

But before we look into that, could you try reproducing the original problem?

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" ())





reply via email to

[Prev in Thread] Current Thread [Next in Thread]