Subject: bug#75922: CPU hogs with pgtk

From: Nicolas Sarlin <[email-masked]>
Date: Wed, 29 Jan 2025 17:49:15 +0100

On Wed, 29 Jan 2025 at 17:35, Eli Zaretskii <[email-masked]> wrote:
>
> > 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?

No I was speaking of the emacs process consuming cpu. Maybe there is
some issue with how I collect the report.
But I can reproduce it fairly easily, and every time I get a similar
report (with emacs running at 100% during the freeze).