GNU bug report logs - #76964
31.0.50; completion-preview-mode uses a lot of CPU

Previous Next

Package: emacs;

Reported by: Geza Herman <geza.herman <at> gmail.com>

Date: Tue, 11 Mar 2025 23:09:02 UTC

Severity: normal

Found in version 31.0.50

Fixed in version 30.2

Done: Eshel Yaron <me <at> eshelyaron.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 76964 <at> debbugs.gnu.org (full text, mbox):

From: Eshel Yaron <me <at> eshelyaron.com>
To: Geza Herman <geza.herman <at> gmail.com>
Cc: 76964 <at> debbugs.gnu.org
Subject: Re: bug#76964: 31.0.50; completion-preview-mode uses a lot of CPU
Date: Wed, 12 Mar 2025 07:48:38 +0100
Hi Geza,

Geza Herman <geza.herman <at> gmail.com> writes:

> When moving around a buffer with completion-preview-mode enabled, CPU
> usage becomes very high.
>
> Profiling the problem reveals that with completion-preview-mode,
> redisplay_internal takes much more CPU.
>
> The problem is in completion-preview--post-command, which calls
> (completion-preview-active-mode -1). For some reason, even though this
> should be a nop when just moving around a buffer, it forces emacs to
> do some more thorough redisplay. If I change this code to "(when
> completion-preview-active-mode (completion-preview-active-mode -1))",
> the problem goes away.
>
> I think the problem is inside the define-minor-mode macro, because if
> I change completion-preview-active-mode to an empty minor mode
> definition:
>
> (define-minor-mode completion-preview-active-mode
>   "Mode for when the completion preview is shown."
>   :interactive nil)
>
> the problem still happens. Note: looking inside the define-minor-mode
> macro, I see a (force-mode-line-update) call. I'm not sure it's
> related, but it has a chance that it is.

Thanks for investigating and reporting.  I think that conditioning the
(completion-preview-active-mode -1) in completion-preview--post-command
as you suggest makes sense.  Would you like to provide a simple patch
with that change?


Best,

Eshel




This bug report was last modified 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.