unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dim1212k@gmail.com, emacs-devel@gnu.org
Subject: Re: Garbage collector: is 800kb a good default?
Date: Thu, 09 Apr 2020 14:42:56 -0400	[thread overview]
Message-ID: <jwv5ze84ifk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83h7xsoi03.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 09 Apr 2020 17:23:24 +0300")

>> What you're pointing out is that from the user's point of view, a GC
>> during idle time is free (so it can occur frequently) and also that
>> a GC during non-idle time can delay redisplay, so (ignoring all
>> other impacts of GC) we should refrain from running GC while
>> non-idle and trigger GC everything we're idle.
> 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,

The argument for GC-when-idle goes that if this happens it's not really
worse than what we have now, because if the GC hadn't started "before
the user starts typing", it would have run as part of the command
launched by the user, so from the user's point of view there's no
noticeable difference.

> specially if gc-cons-threshold is high.  So it isn't entirely "free".

In my sample patch I set the "idle GC threshold" to half of the normal
threshold, which means that we'll GC about twice as often.  In such
a case, as long as the probability that the "user starts typing" in the
middle of a GC is less than 50%, the user's commands will not be delayed
by GC more often than with the current strategy.

The actual probability that the user starts typing in the middle of an
idle GC depends on how much idle we wait before starting the GC, how
much a GC takes, and the distribution of time between user events.
But it should be pretty easy to keep it below 50%.

> Also, we already try running GC each time Emacs becomes idle.

Do we?  I thought so as well, but I couldn't see any evidence of it in
the code.


        Stefan




  reply	other threads:[~2020-04-09 18:42 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv5ze84ifk.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).