emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Larger GC thresholds for non-interactive Emacs


From: Stefan Monnier
Subject: Re: Larger GC thresholds for non-interactive Emacs
Date: Sat, 18 Jun 2022 09:16:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Ihor Radchenko [2022-06-18 13:35:04] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> BTW, I seen everyone's focused on `gc-cons-threshold` but that variable
>> does not adapt to the heap size, so maybe we'd be better off
>> playing with `gc-cons-percentage`.
> I am not sure if `gc-cons-percentage' is reliable.

>From where I stand it's the only one that's reliable.

It basically controls the percentage of *time* we spend in the GC: if we
assume that the time to perform a GC is proportional to the heap size,
and that the allocation rate (in MB/s) is more or less constant, then
`gc-cons-percentage' directly controls the percentage of time spent in
the GC.

Of course, those two assumptions don't hold exactly, but they're fairly
good approximations of reality.

Tweaking `gc-cons-threshold` on the other hand is very coarse and
brittle: if the value is significantly smaller than the heap, then we'll
spend too much time in the GC and if it's significantly larger then we
waste a lot of memory on garbage.  There simply can't be any "one good
value" for `gc-cons-threshold`.

> When we have a small heap (at the beginning of the batch command run),
> the GC will be triggered frequently.

Yes, but the GC cycles will finish quickly.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]