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

From: Dmitry Gutov <[email-masked]>
Date: Sat, 17 Oct 2020 23:44:03 +0300

On 17.10.2020 10:13, Lars Ingebrigtsen wrote:
> And here's the benching with the patch applied:
> 
> (benchmark-run 1000
>    (vc-responsible-backend "/tmp/git-dir/dir1/dir2/hg-dir/bar"))
> => (0.375446369 10 0.07836344099999998)
> 
> (benchmark-run 100
>    (vc-responsible-backend "/ssh:stories:/tmp/git-dir/dir1/dir2/hg-dir/bar"))
> => (3.485639896 110 1.00616348)
> 
> Er...  the local version is now faster?  Is a throw expensive, somehow?
> Probably not very significant.

Is it possible that you didn't restart Emacs between the tests?

vc-git-root (at least) does some caching, which muddies the waters.

Or try this test, with both versions of code:

(benchmark-run 1000
   (progn (vc-file-clearprops FILE)
          (vc-responsible-backend FILE)))

> But as expected, the tramp version is slower, because it does more
> lookups remotely.  But not hugely.

By 23%? That's a bit more than I expected just by looking at 
vc-handled-backends, which has 9 elements. 1/9 => 11%.

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).