From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP Date: Sun, 08 Sep 2024 20:53:46 +0300 Message-ID: <86a5givxp1.fsf@gnu.org> References: <87o75241qh.fsf@gmail.com> <86plpi2ixa.fsf@gnu.org> <87seudke20.fsf@gmail.com> <8634md2vc2.fsf@gnu.org> <87h6asrk42.fsf@gmx.de> <86a5gk28ht.fsf@gnu.org> <87le0450x8.fsf@gmx.de> <865xr8228d.fsf@gnu.org> <87jzfofzcl.fsf@gmail.com> <8634mc1ty0.fsf@gnu.org> <87h6asl3hl.fsf@gmail.com> <86ttesyo1t.fsf@gnu.org> <87bk0zjzt1.fsf@gmx.de> <86a5gjy02i.fsf@gnu.org> <87wmjn2wq5.fsf@gmail.com> <87seuaids7.fsf@gmx.de> <86frqaweo2.fsf@gnu.org> <87a5gigo9b.fsf@gmx.de> <86cylew3tr.fsf@gnu.org> <87ed5u6qkw.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9631"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael.albinus@gmx.de, suhailsingh247@gmail.com, 73046@debbugs.gnu.org To: Suhail Singh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 08 19:54:10 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 1snM6z-0002OO-8l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Sep 2024 19:54:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1snM6r-0001UQ-1v; Sun, 08 Sep 2024 13:54:01 -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 1snM6q-0001UI-CB for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 13:54:00 -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 1snM6q-0007gR-2Y for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 13:54:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=Jf56n6ixJThyOqaf4yT3+djeyhiXHUHT/2eZOz5Knxs=; b=NkFyI7TjQrIN6RFQFCk8L5QTPjbDRQLgJcWeLE11h+aLOnPdZu4XGYlHoidZi2kXlkmFalzRJqraS+mJa5HweF9jjBU4RxfmQdNDtT+IpZ/KEj7+K0uEewHh3bzuLMnRCmP5Z5a2Uk4GmLl9US/MRBFCqgQMMFd/iiJemsoXvHiIWAxfPtrj/5T3I5J8AZl/DBEIu4cJp58zMZJjNI7f8g+ZKeKqPR9m/CNAUZvuvUkBfyVHdZZw9mYlIja0kjZrSNr9cpdPX4AQUAKRKnAWh9z1i1HhZAzXljI40xvX6tNat8Dyrq7szL8Apj+0zsoxRwOW7CTAH5fXNy/s8uOasw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1snM6s-00023R-FZ for bug-gnu-emacs@gnu.org; Sun, 08 Sep 2024 13:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Sep 2024 17:54: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.17258180387885 (code B ref 73046); Sun, 08 Sep 2024 17:54:02 +0000 Original-Received: (at 73046) by debbugs.gnu.org; 8 Sep 2024 17:53:58 +0000 Original-Received: from localhost ([127.0.0.1]:60014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snM6o-000237-4q for submit@debbugs.gnu.org; Sun, 08 Sep 2024 13:53:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snM6l-00022s-SY for 73046@debbugs.gnu.org; Sun, 08 Sep 2024 13:53:56 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1snM6d-0007fm-OC; Sun, 08 Sep 2024 13:53:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Jf56n6ixJThyOqaf4yT3+djeyhiXHUHT/2eZOz5Knxs=; b=QxEBS4rdRXrQ Gxelve7+zsjVwIpFWS2SJxkwEB8AnB32QC+mi0DNSzC34NK81zDTj8bID6zzeIQ8vv8vEkqrDXO8r X0PqR+E98Hh29Nc0Gn+TObDeNnia0S/sPnzjujCyt+5r0eq7L1mjNuhV77k2JWTaVyILhneEy4PkG ot2rDdNPE3DUbgj4Iaj4Q4UKZnOpQ2NYBnJmVXk/OavgnAgovBd3fPfr38DpV+uHqPpTVZ83t2OBX XvpgG7SQ4AWbLnCusOqvrB28AHGlI/dOl6nHVWfw09OCUkuYjd8Mcvcjajg9s/p7GhZXAs6JmgJjY 3/c9NuhdiZt+ri8H22vDSA==; In-Reply-To: <87ed5u6qkw.fsf@gmail.com> (message from Suhail Singh on Sun, 08 Sep 2024 12:46:39 -0400) 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:291476 Archived-At: > From: Suhail Singh > Cc: Michael Albinus , suhailsingh247@gmail.com, > 73046@debbugs.gnu.org > Date: Sun, 08 Sep 2024 12:46:39 -0400 > > Eli Zaretskii writes: > > > Waiting for a process to respond should try not to spin without > > sleeping for a few milliseconds between polling attempts. > > A constant delay busy-wait would be better than what's there today. It isn't a delay, or at least the delay is not the main point. The main point is to yield the CPU, and that usually has dramatic effect on CPU load. > However, I thought you'd be proposing something like registering a > "callback". Out of curiosity, since I am unfamiliar with the relevant > Emacs internals, would it not be possible to add a function to the > equivalent of `after-change-functions' that processes the output? accept-process-output already does that. Except that with a timeout of zero, it just checks whether any output arrived, and if not, returns immediately. Adding a timeout will AFAIU cause us to let the OS preempt our execution thread and reschedule it only if no output arrives during the timeout.