Subject: bug#73046: 29.4; Emacs 100% CPU usage for several seconds when opening dired buffer over TRAMP

From: Michael Albinus <[email-masked]>
Date: Tue, 10 Sep 2024 10:10:19 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> The umbrella function is tramp-send-command. It sends the command to
>> remote via tramp-send-string, and waits then for a proper shell prompt
>> via tramp-wait-for-output. The latter function calls
>> tramp-wait-for-regexp, which loops using tramp-accept-process-output.
>
> Did you try either calling accept-process-output with a non-zero
> timeout of, say, 5 msec, or inserting a (sit-for 0.005) into the loop
> which calls tramp-accept-process-output?

Tramp used a non-zero timeout in the past. This was removed some years
ago, I don't remember the reason.

I've added (sit-for 0.005) in the loop calling
tramp-accept-process-output. It decreases the CPU load from 100% to
something between 45..50%, when waiting for a response from
remote. Pushed to master, and thanks for the explanation!

Best regards, Michael.