From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP Date: Fri, 06 Sep 2024 15:23:57 +0200 Message-ID: <87h6asrk42.fsf@gmx.de> References: <87o75241qh.fsf@gmail.com> <86plpi2ixa.fsf@gnu.org> <87seudke20.fsf@gmail.com> <8634md2vc2.fsf@gnu.org> Reply-To: Michael Albinus Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25611"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Suhail Singh , 73046@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 06 15:31:03 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1smZ3G-0006U9-V1 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Sep 2024 15:31:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smZ2T-000692-A7; Fri, 06 Sep 2024 09:30:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smZ2L-0005Xw-Oc for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 09:30:05 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smZ2K-0008SW-Lr for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 09:30:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=OSwqCON6B/ACY2B6EF1AP8TxSZPSVGQc3JsyfDrU8Qc=; b=nqyPQd+dr1/keiKFryc+QWSdUGMICrHWnZbqgq2/OtBYdlbl+zV7HtMTpbn5aXkddO8Jm+ejR+7ZVM/o0MZieS7mIWX4HMNyiRXtxccobXjE9BejXZQ5GGHAcFw02abXR7AckdrcjtOigbUqwmovBl6+Y4i1eHG4CLpX6Fpkx5c0+pm2r8GEa9Y/OF9n4dZSEwOt/YKkcqkdZK02VfbSkEw0Q94vZkWVdQFgkA0GR82JYTbGjHtoyvz3DlYRnyr3ZKVPz7D3Z+raSyWxFE6GVZ2+AkTWCa0QbE0Z+5BxNDfXy+kbP1fiUaJV3rGu0fKqvDf6DViyxmcFVVhpWFa9wA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1smZ2J-0007T8-0d for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 09:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Sep 2024 13:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73046 X-GNU-PR-Package: emacs Original-Received: via spool by 73046-submit@debbugs.gnu.org id=B73046.172562936428608 (code B ref 73046); Fri, 06 Sep 2024 13:30:02 +0000 Original-Received: (at 73046) by debbugs.gnu.org; 6 Sep 2024 13:29:24 +0000 Original-Received: from localhost ([127.0.0.1]:52483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smZ1g-0007RM-6k for submit@debbugs.gnu.org; Fri, 06 Sep 2024 09:29:24 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:47661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smZ1d-0007Ql-Ls for 73046@debbugs.gnu.org; Fri, 06 Sep 2024 09:29:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1725629355; x=1726234155; i=michael.albinus@gmx.de; bh=OSwqCON6B/ACY2B6EF1AP8TxSZPSVGQc3JsyfDrU8Qc=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=dTLjZwyeDuvXV0Q972EslnD6R0ca2boi7dMMy9JDZIz2tGi5ox11hukEq6kVrOov trMP+YP8g/QQS8P4wbq9DlzZI5hyg4cJn5CgfwRwL52VlLr13FQ+WaSTrFxrNZTa8 +3nLeqyyMQk8FIYan65j5UGVJpHnrnx5hyoP+kDDDgwfyGiHDmdDjpp7vgSnRURgV I9+WyS4+KiyGuU9y2658WZhmYWNvKtRwG8mBg68nruCj2DrZ3v+6eajB7mb+uhca8 BBkjecMrKjibKLm/hvqV6lcOhqcCyz0whq5BpsZmO3vUn1qIkv83HnGkpQGQHMgs4 rp/Zr3sOnQU5sB0R4w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N5VD8-1rxgEb0pXm-016wzp; Fri, 06 Sep 2024 15:24:03 +0200 In-Reply-To: <8634md2vc2.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 06 Sep 2024 08:40:45 +0300")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uDnPzg+/qSeYXKTvh6jCHshTlIo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291312 Archived-At: Eli Zaretskii writes: Hi, >> >> It would also help if being over a slow connection didn't result in >> >> Emacs consuming 100% of the CPU via functions such as >> >> `tramp-wait-for-regexp' (based on profiler-report). Could some of t= his >> >> be done asynchronously? >> > >> > You could probably tell which parts take the time by profiling Emacs >> > while it collects the Dired data, using profiler.el. This could give >> > clues about the expensive parts. My guess would be that retrieving >> > the attributes of the files Dired needs are the reason, but I could b= e >> > wrong. >> >> Based on =3Dprofiler-report=3D, the following function "chains" consume= most of the >> CPU: >> - `font-lock-fontify-keywords-region' >> - tramp-sh-file-name-handler >> - tramp-sh-handle-file-truename >> - `tramp-wait-for-regexp' >> - tramp-sh-handle-file-exists-p >> - `tramp-wait-for-regexp' >> - tramp-sh-handle-file-directory-p >> - `tramp-wait-for-regexp' >> - tramp-sh-handle-file-attributes >> - `tramp-wait-for-regexp' >> >> As noted previously, disabling global-font-lock-mode helps. > > 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'. I believe it would be helpful to suppress these checks via a user option. And no, the checks shouldn't be suppressed for remote directories in general, on a fast connection they are valuable. In bug#17064, the impact of these calls where discussed. The conclusion wa= s =2D-8<---------------cut here---------------start------------->8--- > Or could this have any bad side effects? Is it maybe too heavy to call > `file-truename'? Normally, there aren't many symlinks in a buffer, so I think the performance impact would be negligible. =2D-8<---------------cut here---------------end--------------->8--- Likely, this was too optimistic ... Best regards, Michael.