all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Suhail Singh <suhailsingh247@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Eli Zaretskii <eliz@gnu.org>,
	suhailsingh247@gmail.com, 73046@debbugs.gnu.org
Subject: bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP
Date: Fri, 06 Sep 2024 12:56:26 -0400	[thread overview]
Message-ID: <87o750g1qd.fsf@gmail.com> (raw)
In-Reply-To: <87le0450x8.fsf@gmx.de> (Michael Albinus's message of "Fri, 06 Sep 2024 16:09:23 +0200")

Michael Albinus <michael.albinus@gmx.de> writes:

>>> > FWIW, I cannot reproduce this: I tried Dired on a remote host with
>>> > which I have connection that is quite slow, and saw neither high CPU
>>> > usage nor a significant delay in displaying a Dired buffer.
>>>
>>> It seems to be related to font-locking, indeed. See variable
>>> `dired-font-lock-keywords'. It specifies face recognition running basic
>>> file oprtations. For example, ";; Broken Symbolic link" calls
>>> `file-truename' and `file-exists-p', while "Symbolic link to a directory"
>>> and ";; Symbolic link to a non-directory" invoke `file-truename' and
>>> `file-directory-p'.
>>
>> But font-lock is ON by default, so what I saw also includes this,
>> right?
>
> Sure. But we don't know the exact setting of the OP. The connection
> could be extremely slow for him, Tramp's cache might be disabled,
> whatever. Perhaps it's worth to rerun the test with "emacs -Q".

The issue was observed with emacs -Q on a remote directory that had 22
symlinks.  On the affected host, I am able to reliably reproduce the
issue by evaluating the code below and then navigating to
/tmp/test/links in dired via TRAMP.

#+name: perf-fix/tramp/font-lock-on-dired/reproducer
#+begin_src sh
  cd /tmp
  rm -rf /tmp/test
  mkdir /tmp/test
  cd /tmp/test
  for i in `seq -w 0 21`; do
      mkdir -p src/"$i"
  done
  mkdir -p links
  cd links
  for i in `seq -w 0 21`; do
      ln -sf /tmp/test/src/"$i"
  done
#+end_src

Notably, for the affected host, the issue is reproducible using above
even after a new OS install.  However, the above test case doesn't cover
all variables affecting the issue.  Specifically, when I run the above
code on a different host (with faster connection and fewer hops to get
to) and navigate to /tmp/test/links the severity of the issue is much
less.  That being said, the profiler reports (starting from emacs -Q and
after establishing connection with host in question via TRAMP) for both
the affected and not-as-affected host are similar.  I believe the issue
is present on the unaffected host as well, but with much less severity
for some reason.

My guess is that connection speed (in addition to the number of symlinks
in the directory in question) is a determining factor.  I am speculating
here, but perhaps TRAMP is busy-waiting for a response?  That would be
consistent with what I observe, but I am not sure how to verify that.

>>> I believe it would be helpful to suppress these checks via a user
>>> option.
>>
>> What's wrong with "M-x font-lock-mode RET"?
>
> You would deactivate all fontifications, not only the ones related to
> symlinks.
>
> And you must do this in a hook of the dired buffer, before fontification
> happens.

Yes, precisely.  That is my current workaround.  It's far from ideal,
but it at least allows Emacs to be in a semi-workable state.  It would
be much better if there were a way to suppress only the "expensive"
font-locking checks in this case.

> There exist `dired-hide-details-mode', which I don't know. Perhaps
> enabling it in time would do the job?

It, unfortunately, doesn't help.

-- 
Suhail





  parent reply	other threads:[~2024-09-06 16:56 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 14:24 bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP Suhail Singh
2024-09-05 15:56 ` Eli Zaretskii
2024-09-05 21:04   ` Suhail Singh
2024-09-06  5:40     ` Eli Zaretskii
2024-09-06 13:23       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 13:54         ` Eli Zaretskii
2024-09-06 14:09           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 16:09             ` Eli Zaretskii
2024-09-06 17:47               ` Suhail Singh
2024-09-06 19:08                 ` Eli Zaretskii
2024-09-07  0:19                   ` Suhail Singh
2024-09-07  1:39                     ` Suhail Singh
2024-09-07  6:29                     ` Eli Zaretskii
2024-09-07  8:07                       ` Suhail Singh
2024-09-07 14:36                       ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 15:07                         ` Eli Zaretskii
2024-09-07 17:35                           ` Suhail Singh
2024-09-08 11:30                             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 11:47                               ` Eli Zaretskii
2024-09-08 15:26                                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:41                                   ` Eli Zaretskii
2024-09-08 16:46                                     ` Suhail Singh
2024-09-08 17:53                                       ` Eli Zaretskii
2024-09-10  8:10                                     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11  1:05                                       ` Suhail Singh
2024-09-11 11:50                                         ` Eli Zaretskii
2024-09-11 16:29                                           ` Suhail Singh
2024-09-11 16:38                                             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 17:25                                               ` Suhail Singh
2024-09-12 11:48                                                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 14:13                                         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 15:56                                           ` Suhail Singh
2024-09-13 23:17                                       ` Suhail Singh
2024-09-14  6:24                                         ` Eli Zaretskii
2024-09-14 14:25                                           ` Suhail Singh
2024-09-14 14:41                                             ` Suhail Singh
2024-09-14 15:03                                             ` Eli Zaretskii
2024-09-14 22:36                                               ` Suhail Singh
2024-09-15  5:55                                                 ` Eli Zaretskii
2024-09-15 14:23                                                   ` Suhail Singh
2024-09-14  7:07                                         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14 14:39                                           ` Suhail Singh
2024-09-11 14:06                         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 14:22                     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07 17:58                       ` Suhail Singh
2024-09-08 11:26                         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:09                           ` Suhail Singh
2024-09-08 15:19                             ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-08 15:34                               ` Suhail Singh
2024-09-08 16:35                                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 16:19                                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-06 16:56             ` Suhail Singh [this message]
2024-09-06 16:01         ` Suhail Singh
2024-09-06 15:46       ` Suhail Singh
2024-09-06 15:52       ` Suhail Singh
     [not found] <87v7yz1sw8.fsf@rutgers.edu>
2024-09-13 15:47 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o750g1qd.fsf@gmail.com \
    --to=suhailsingh247@gmail.com \
    --cc=73046@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.