Subject: bug#51692: 29.0.50; High CPU in c++ mode. Type finder?

From: Alan Mackenzie <[email-masked]>
Date: Fri, 12 Nov 2021 19:08:43 +0000

Hello, Yuri.

On Fri, Nov 12, 2021 at 10:47:46 +0100, Yuri D'Elia wrote:
> On Thu, Nov 11 2021, Alan Mackenzie wrote:
> > Yes, there is a bug here.  CC Mode is expected to use a high amount of
> > CPU time (but not 100%) for a few seconds after starting C (etc.) Mode,
> > or for a few minutes after starting Emacs when there's a desktop with a
> > lot of CC Mode files in it.

> > However, with C++ files (and likely Java files, too), a problem with
> > templates caused this 100% usage.

> High-burst is not a problem, however I have a related question. Is it
> normal that repeated C-g didn't abort?

No.  In this particular scenario, though, the 100% CPU usage was
happening in a timer function, so your C-g would just abort the
foreground function, i.e. nothing.  At least in this situation Emacs
wasn't completely frozen, since foreground processing took priority over
the background fontification.

> There's nothing that seemed to work for me except waiting, which means
> that with a few scrolling moves queued I just ended up killing emacs.

Ah.  Sorry.

> I didn't test if there was a difference between JIT/no-JIT versions
> (should there ever be in terms of quitting behavior?)

I don't know that.  But jit is pretty much universal now, apart from
for testing purposes by developers.

> > Then please report back to the bug list confirming that the bug is
> > fixed, or telling me what's still not right.

> Tested in both the small test I posted and the full source file I was
> working with. Applied on master. Seems to be working perfectly now.

Thanks!  That's good to hear.  I'll just give Zhiwei Chen a little time
to reply, and assuming (s)he doesn't find problems, I'll commit the fix.

-- 
Alan Mackenzie (Nuremberg, Germany).