Subject: Re: bug#79074: 31.0.50; Increase gc-cons-percentage in Makefiles

From: Helmut Eller <[email-masked]>
Date: Mon, 28 Jul 2025 13:19:12 +0200

On Sat, Jul 26 2025, Stefan Monnier wrote:

>> It seems that the default value for gc-cons-percentage (10%) is very
>> conservative and hurts performance.
>
> It is definitely very conservative.  But it's used only in
> interactive mode, not in batch mode:
>
>     % src/emacs -Q --batch --eval '(message "%S" gc-cons-percentage)'
>     1.0
>     %

Ah, I didn't know that; but it makes sense.  Which means that the bug
can be closed.

> FWIW, in my interactive mode, I set it to 0.5 so as to try and reduce
> the occurrences of GC while I use Emacs, and then have an idle timer
> that tries to run Emacs during pauses so as to recover some of the
> benefits of more frequent GCs (and to try and avoid running GCs in the
> middle of a command):
>
> Here are the stats for this Gnus process:
>
>     M-x gc--opportunistic-score RET
>     ((jit 1 0 0) (opportunistic-gcs . 2744) (cmd 104 11 28) (earlier-gcs . 69) (noncmd 18 6 16) (commands . 369311))
>
> IOW, the GC ran 2744 times during idle time, it ran 132 times during
> a command (104 of which were "single-run", i.e. a single GC in that
> command, while the other 28 were spread over only 11 commands, so those
> are GCs that are hard to avoid bby delaying the GC to idle time because
> the commands just use a lot of memory), it ran 34 times during a "non
> command" (process filters?  timers?) and it ran once during jit-lock.
> That was during the execution of 369311 commands.

I suppose you collect this data in pre/post-command-hooks?

Helmut