emacs-devel
[Top][All Lists]
Advanced

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

Re: Garbage collector: is 800kb a good default?


From: Dmitrii Korobeinikov
Subject: Re: Garbage collector: is 800kb a good default?
Date: Fri, 10 Apr 2020 22:40:28 +0600

> Depending on what features and packages you use frequently, your
> sessions could produce more or less garbage.  The optimal threshold
> should depend on that.

It would be hard to make general improvements unless one employs
general metrics. History of garbage for the past n milliseconds,
highest memory consumption for the session and such come to mind.
However I am not sure how exactly gc could use these facts while
guaranteeing that the benefits would outweigh the downsides (even on
average).

By the way, the point Stefan is making, I believe, is this: for
continuous actions, if both strategies use the same amount of memory,
the user is guaranteed to experience 100% of gc freeze if it's
non-idle-time. Meanwhile, 100% is just the worst case for the
idle-time strategy. The only tradeoff I see for the idle-time strategy
is the overhead of more frequent calls to the garbage collector. About
the user expecting an immediate response during the idle time: I think
the user always expects an immediate response. Delay is bad in any
case.

Now, what from what I gather in this thread so far, the two problems
with elevating the threshold are:

1. Large heap may slow down the gc. Tests are needed.

2. If a lot of garbage is generated after some process, the user will
experience a lag if he interacts w/ emacs right after (well, after the
idle time). This kind of scenario seems like a rarity to me. And in
case it happens, the lag probably wouldn't have to be that long
anyway. Plus, if it comes to that, sequential or concurrent gc solves
this problem in its entirety.

It would also help to know what's the point at which threshold
elevation starts giving only negligible benefits. Usage patterns /
scenarios are needed to test this.

Best,
DK

чт, 9 апр. 2020 г. в 22:42, Eli Zaretskii <address@hidden>:
>
> > From: Dmitrii Korobeinikov <address@hidden>
> > Date: Thu, 9 Apr 2020 20:46:53 +0600
> > Cc: emacs-devel <address@hidden>
> >
> > > The "right" value depends on your usage patterns, among other
> > > factors.  How to account for that in the default value?
> >
> > I am not sure what you mean exactly by usage patterns.
>
> Depending on what features and packages you use frequently, your
> sessions could produce more or less garbage.  The optimal threshold
> should depend on that.
>
> > > Let's not forget that running GC while Emacs is idle will make Emacs
> > > less responsive if the user starts typing while GC is in progress,
> > > specially if gc-cons-threshold is high.  So it isn't entirely "free".
> >
> > Maybe it would be possible to garbage collect in chunks and check
> > after each chunk for input?
>
> AFAIU, this will be hard, since Lisp data structures are very
> recursive.  But maybe I'm missing something.



reply via email to

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