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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 20 Sep 2024 13:47:15 +0300

> From: Michael Albinus <[email-masked]>
> Cc: Suhail Singh <[email-masked]>,  [email-masked]
> Date: Fri, 20 Sep 2024 11:54:28 +0200
> 
> 4. Use (sit-for 0) in `tramp-wait-for-regexp'.
> 
> Emacs consumes 72% .. 74% CPU, the same as in 3. The test suite reports
> 
> --8<---------------cut here---------------start------------->8---
>    passed  1/2  tramp-test11-copy-file (1.562353 sec)
>    passed  2/2  tramp-test12-rename-file (1.626922 sec)
> --8<---------------cut here---------------end--------------->8---
> 
> Seems to be the best compromise, I'm in the mood to apply.

Using (sit-for 0) is IMO okay, it means Emacs is yielding its CPU
slice, but is ready to run immediately after that.