Subject: Re: bug#75922: CPU hogs with pgtk

From: Eli Zaretskii <[email-masked]>
Date: Wed, 29 Jan 2025 18:35:06 +0200

> From: Nicolas Sarlin <[email-masked]>
> Date: Wed, 29 Jan 2025 17:02:16 +0100
> Cc: [email-masked]
> 
> On Wed, 29 Jan 2025 at 14:06, Eli Zaretskii <[email-masked]> wrote:
> >
> > The profile says most of the time is spent in sit-for called from
> > lsp-request-while-no-input.  First, sit-for is not supposed to consume
> > CPU, because it's a waiting function.  Are you sure this profile was
> > taken when Emacs was hogging CPU?
> >
> > And second, lsp-mode is not part of Emacs, so if indeed the above is a
> > profile representative of high CPU load, I suggest to report this to
> > the developers of lsp-mode first, even though the problem appears only
> > in the PGTK build.
> >
> > Thanks.
> 
> Hi, thank you for your answer.
> Yes, this profile was collected during an emacs freeze. It took me a
> few second (maybe 10) after `profiler-start` to trigger the freeze,
> then again a few seconds of freeze, then I ran `profiler-stop`
> directly after. During the freeze I had one CPU core constantly
> running at 100%.

But maybe the process which was consuming the CPU at that time was not
Emacs?  Because sit-for should not consume CPU, it just waits for some
input (or for timeout).  Is it possible that while Emacs waited, some
other process, perhaps the LSP server itself, was spinning the CPU?