all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitrii Korobeinikov <dim1212k@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Garbage collector: is 800kb a good default?
Date: Fri, 10 Apr 2020 22:40:28 +0600	[thread overview]
Message-ID: <CA+Yh0SRFh620xsg8DCMLeHPEF-1MA9yBiLNmeWvY+F0nmMGQWQ@mail.gmail.com> (raw)
In-Reply-To: <83d08gobke.fsf@gnu.org>

> 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 <eliz@gnu.org>:
>
> > From: Dmitrii Korobeinikov <dim1212k@gmail.com>
> > Date: Thu, 9 Apr 2020 20:46:53 +0600
> > Cc: emacs-devel <emacs-devel@gnu.org>
> >
> > > 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	other threads:[~2020-04-10 16:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 11:59 Garbage collector: is 800kb a good default? Dmitrii Korobeinikov
2020-04-09 12:33 ` Eli Zaretskii
2020-04-09 13:44   ` Dmitrii Korobeinikov
2020-04-09 14:02     ` Eli Zaretskii
2020-04-09 14:46       ` Dmitrii Korobeinikov
2020-04-09 16:42         ` Eli Zaretskii
2020-04-10 16:40           ` Dmitrii Korobeinikov [this message]
2020-04-09 19:05         ` Stefan Monnier
2020-04-10 16:26           ` Dmitrii Korobeinikov
2020-04-09 18:48     ` Stefan Monnier
2020-04-10 14:26   ` Bruno Félix Rezende Ribeiro
2020-04-10 16:49     ` Eli Zaretskii
2020-04-10 18:26       ` Bruno Félix Rezende Ribeiro
2020-04-10 18:53         ` Paul Eggert
2020-04-09 13:47 ` Stefan Monnier
2020-04-09 14:20   ` Dmitrii Korobeinikov
2020-04-09 14:23   ` Eli Zaretskii
2020-04-09 18:42     ` Stefan Monnier
2020-04-09 19:08       ` Eli Zaretskii
2020-04-09 19:31         ` Stefan Monnier
2020-04-10  6:19           ` Eli Zaretskii
2020-04-10 13:03             ` Stefan Monnier
2020-04-10 13:42               ` Eli Zaretskii
2020-04-10 14:34                 ` Stefan Monnier
2020-04-10 14:38                   ` Stefan Monnier
2020-04-10 15:37                   ` Eli Zaretskii
2020-04-10 15:52                   ` Andrea Corallo
2020-04-10 16:45                     ` Stefan Monnier
2020-04-10 17:18                       ` Andrea Corallo
2020-04-09 14:48   ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+Yh0SRFh620xsg8DCMLeHPEF-1MA9yBiLNmeWvY+F0nmMGQWQ@mail.gmail.com \
    --to=dim1212k@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.