From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Suhail Singh 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 12:01:28 -0400 Message-ID: <87seucg49z.fsf@gmail.com> References: <87o75241qh.fsf@gmail.com> <86plpi2ixa.fsf@gnu.org> <87seudke20.fsf@gmail.com> <8634md2vc2.fsf@gnu.org> <87h6asrk42.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33430"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , Suhail Singh , 73046@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 06 18:03:44 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 1smbR1-0008Xg-Sx for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Sep 2024 18:03:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smbQz-0001ID-1P; Fri, 06 Sep 2024 12:03:41 -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 1smbQb-0000mF-Fr for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 12:03:20 -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 1smbQM-0001Iu-C6 for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 12:03:17 -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=gNei6m+ksh+f/pVKVdhhLazGE3zPeEdH60JWvzgsFAc=; b=ByxP6pamRXnRZkgb+GupiP4cHp3V1CvkoG6bhqamdhKHPiBb+SP9aKqb2ZAi6ttaN01l6JJc5BQVuSGwNFHnhvdc8frmXUa/2hsTXH7sJWQFjV4fd+5gv/Lut98kEHgIjNaOsfhAuwUUREivDjcbbAfHP1o1xJqDqpDkqHKAJw4lEnCyn/4uA6uDQodrEwmJY9QRejRheHRo4roYNQgmBdeUsi763A4FJS8onZy+QgdNev5NQoKAeIoLScWKArkUwSQL/ZYmsDRF0Eg8XvJFA4VY3zrY8yY/zjQz17s5D1wH8zuuSo2+Hsfemq2ZEGlYo8NhDUiK/385nb376TnoSw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1smbQL-0008F2-TT for bug-gnu-emacs@gnu.org; Fri, 06 Sep 2024 12:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Suhail Singh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Sep 2024 16:03:01 +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.172563856831653 (code B ref 73046); Fri, 06 Sep 2024 16:03:01 +0000 Original-Received: (at 73046) by debbugs.gnu.org; 6 Sep 2024 16:02:48 +0000 Original-Received: from localhost ([127.0.0.1]:53998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smbQ8-0008ET-Da for submit@debbugs.gnu.org; Fri, 06 Sep 2024 12:02:48 -0400 Original-Received: from mail-qt1-f193.google.com ([209.85.160.193]:46442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smbQ5-0008EC-MB for 73046@debbugs.gnu.org; Fri, 06 Sep 2024 12:02:46 -0400 Original-Received: by mail-qt1-f193.google.com with SMTP id d75a77b69052e-456850b370eso13572001cf.1 for <73046@debbugs.gnu.org>; Fri, 06 Sep 2024 09:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725638500; x=1726243300; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=gNei6m+ksh+f/pVKVdhhLazGE3zPeEdH60JWvzgsFAc=; b=da4C90+fggVShr9qxay2cCBzqjdfZYfXIiT+bSw9p7IAJO430lgh7NXSsJX+eteMJ0 Yb1yn1gOe/YIGXPv2l0A44YOeUQO6R0rlkk72dJNUDWSLWOeBWzIk5bF0TwGAHQSl7bX 4r8I3g962Go4rFr2IEBAtXHxgIKRDzHIC2AMc0YdZMpX7/gR8UoTWYTGSBHpQI10/0yb xHY7nluHPTIqDylZOreDPV1NyEupRVlAJOZcSjKwACSdwgVKYbLJ7nXPccdWIgQhpKjJ Px2aO3pmbshMQmKBuHoWPWYs9a/IZGkAVdrqHIwHngaaifIY9MXhsc/SwerSog28KMkT Il1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725638500; x=1726243300; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gNei6m+ksh+f/pVKVdhhLazGE3zPeEdH60JWvzgsFAc=; b=YHfDTsHFe+LyCcjkzJLWuPhoNHgpHz7eD2EXS/hbKqU5Z92Yxm7qpRCN3xGRryZlLM BW014YrGkNf96M/VKg8K4pY5TDQU9JMXuxwW7OybVbI7xSi+HphsMkq07y/WHpgkbOP1 f8qJApeovg7Mgsu3pQSSAV+Wd5X+5LhurgrSI9fbDXf+GYAewdp2PR6bWyKLURjm4vmB NN64HJLWXZcbVjIXkCYpnqF3iuTtJVU2zXjqw3Y+FFsWZmm6VGo5WrGir68CIrQAA9IX uOt1dftTK9Ys3Oab7A4ptMgeB3e4U7+wyHXv80wVZtK2H3cKMD5wgVt6RsY4cdNOei/w 80IA== X-Forwarded-Encrypted: i=1; AJvYcCXi5j5vGd/vYu1llgzl8kZi89TjMQbpQmzmmeZ8+Zl0T/eL6UyL54e96uddknJW+uamyVAs6A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzLQkBWHMoc+nx03kKdjSAe/tzxElKDjPw+11RDaJSnrIhcbtCJ ivbCeSjstv+xBYhdXYau5DMDmxUK+12WpEV6IB6TnI4rYONWwcTCwVLM5UUQ X-Google-Smtp-Source: AGHT+IEx8pSAOHrw4KWJL57IyOtM5cvLYhpm/IgWgiRzUff9PuYL7zLVDvFUgVywwystaUmQRgsSgg== X-Received: by 2002:a05:622a:20c:b0:456:7529:71d with SMTP id d75a77b69052e-4580c6719f2mr37828801cf.9.1725638500084; Fri, 06 Sep 2024 09:01:40 -0700 (PDT) Original-Received: from gnus ([65.94.70.53]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45801dc1824sm17206581cf.86.2024.09.06.09.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 09:01:39 -0700 (PDT) In-Reply-To: <87h6asrk42.fsf@gmx.de> (Michael Albinus's message of "Fri, 06 Sep 2024 15:23:57 +0200") 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:291322 Archived-At: Michael Albinus writes: >>> Based on =profiler-report=, 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. I agree. Having a user configuration(s) that allows one to selectively disable some of the possibly more expensive checks would be valuable. If that were available, user configuration code could determine their own rules or thresholds as to when those options should be toggled (without disabling font-locking in its entirety). If performance degradation could be dynamically checked by Emacs (something akin to so-long-action and so-long-predicate, but for this instance of font-locking instead) that would be ideal, but it may not be easy to implement and it certainly isn't necessary - when things get unresponsive, it's pretty apparent. > And no, the checks shouldn't be suppressed for remote directories in > general, on a fast connection they are valuable. I agree. > In bug#17064, the impact of these calls where discussed. The conclusion was > >> 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. > > Likely, this was too optimistic ... For the host where I noticed this issue, the directory in question had 22 symlinks. -- Suhail