Subject: Re: Bug#24126: vc-hg-state can be extremely slow

From: Jonathan Kotta <[email-masked]>
Date: Mon, 10 Mar 2025 16:24:02 -0500

Unfortunately I don't even have any hg repos I work with any more.  I use
magit for almost everything these days.  So I guess from my perspective it
doesn't matter any more.

I tested `vc-root-diff` on Emacs 29.4 with the repo described below, and
though it's slow the first time it seems to be much faster on subsequent
calls, probably due to caching in Emacs.  I'd argue it's still unacceptably
slow, because there can be an arbitrary number of ignored files.  The
fundamental bug is assuming `hg status -A some_directory` is a fast
operation, when it can easily take many seconds or even minutes because
it's proportional to the number of files under some_directory.

mkdir /tmp/foo
hg init
echo -e "syntax: glob\n*" > .hgignore
for i in $(seq 1000) ; do mkdir $i ; (cd $i ; touch $(seq -s ' ' 1000));
done

$ time hg status -A ./ | wc
1000001 2000002 9786012

real 0m4.748s
user 0m3.703s
sys 0m1.063s

$ time hg status ./ | wc
      0       0       0

real 0m0.124s
user 0m0.101s
sys 0m0.024s

Here's some timing on one of my Yocto repos:

$ time hg status -A | wc
5074646 10180682 727258295

real 1m6.047s
user 0m23.774s
sys 0m26.154s

$ time hg status | wc
      0       0       0

real 0m0.204s
user 0m0.090s
sys 0m0.054s

On Fri, Mar 7, 2025 at 8:57 PM Sean Whitton <[email-masked]>
wrote:

> tag 24126 + moreinfo
> thanks
>
> Hello,
>
> It sounds like this bug may well still exist but there isn't enough
> information in this particular report for anyone to do any work on it.
>
> Therefore I would propose we close it, unless, Jonathan, you would be
> able to provide a tarball of a Mercurial repository that shows the
> problem, perhaps.
>
> --
> Sean Whitton
>

-- 
Thanks,

Jonathan Kotta

Hofstadter's Law:
    It always takes longer than you expect, even
    when you take into account Hofstadter's Law.