From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Garbage collector: is 800kb a good default? Date: Fri, 10 Apr 2020 09:19:45 +0300 Message-ID: <83y2r3n9q6.fsf@gnu.org> References: <83h7xsoi03.fsf@gnu.org> <834ktso4t2.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="62143"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dim1212k@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 10 08:20:34 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMn1m-000G5j-Gq for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Apr 2020 08:20:34 +0200 Original-Received: from localhost ([::1]:59042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMn1l-00055Z-Jy for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Apr 2020 02:20:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60863) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMn1H-0004fN-KK for emacs-devel@gnu.org; Fri, 10 Apr 2020 02:20:04 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jMn1H-0007W0-GU; Fri, 10 Apr 2020 02:20:03 -0400 Original-Received: from [176.228.60.248] (port=1410 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jMn1G-00070k-HX; Fri, 10 Apr 2020 02:20:03 -0400 In-Reply-To: (message from Stefan Monnier on Thu, 09 Apr 2020 15:31:43 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246741 Archived-At: > From: Stefan Monnier > Cc: dim1212k@gmail.com, emacs-devel@gnu.org > Date: Thu, 09 Apr 2020 15:31:43 -0400 > > No, that's not what I was saying. What I was saying is that in the"idle > GC case" the events are as follows: > > 1- 100%-N% of the GC runs while idle. > 2- the user hits a key > 3- the remaining N% of the GC runs. > 4- the command runs > > whereas in the non-idle GC what happens is: > > 1- the user hits a key > 2- the command starts > 3- the GC gets run > 4- the command continues and finiches > > To the user, the result is pretty much the same: in both cases Emacs > took "time to run the command + time to GC" before responding. We are miscommunicating. My complaint was about the _response_ time, which is the time that passes between me pressing a key and Emacs reacting to that. In your description above it is the time between "the user hits a key" and "the command starts". That GC happens during the time the command runs is less annoying, because the user sees a responsive Emacs. You can try it yourself: set up an idle timer that would call a long-running function, then try typing something while it runs. > > /* If there is still no input available, ask for GC. */ > > if (!detect_input_pending_run_timers (0)) > > maybe_gc (); > > But that's not the same: this "maybe_gc" rarely triggers because it uses > the same thresholds as normal code evaluation, so if the GC was not > triggered while running the last command it usually won't trigger > here either. We have no guarantee that GC has an opportunity to run every command, do we? It very much depends on what that command did. Thus, this call is not really a no-op. > The fundamental idea of idle-GC is to use a *lower* threshold while > idle, so as to increase the probability that the GC happens on that > occasion rather than one of the other "maybe_gc" checks. We can easily do that, I think. Most of the code is already there.