From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Eager garbage collection Date: Mon, 16 Nov 2020 18:34:47 +0200 Message-ID: <835z65tg48.fsf@gnu.org> References: <87ft5akkjv.fsf@catern.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2078"; mail-complaints-to="usenet@ciao.gmane.io" Cc: sbaugh@catern.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 16 17:38:15 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 1kehWA-0000R3-Bh for ged-emacs-devel@m.gmane-mx.org; Mon, 16 Nov 2020 17:38:14 +0100 Original-Received: from localhost ([::1]:43150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kehW9-0005SI-Bi for ged-emacs-devel@m.gmane-mx.org; Mon, 16 Nov 2020 11:38:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kehT0-0002G7-2P for emacs-devel@gnu.org; Mon, 16 Nov 2020 11:34:58 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36249) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kehSz-00080D-5x; Mon, 16 Nov 2020 11:34:57 -0500 Original-Received: from [176.228.60.248] (port=3580 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kehSw-00034z-C9; Mon, 16 Nov 2020 11:34:56 -0500 In-Reply-To: (message from Stefan Monnier on Mon, 16 Nov 2020 10:07:58 -0500) 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:259237 Archived-At: > From: Stefan Monnier > Date: Mon, 16 Nov 2020 10:07:58 -0500 > Cc: emacs-devel@gnu.org > > This will cause an eager GC right after Emacs goes idle, which can > happen while the user is actively typing. I think it would be > preferable to run this from an idle timer to make sure that we run > during an actual pause of incoming events. Your code effectively uses > an idle-time of 0, and I'm not sure what idle-time we should > use instead. > > Admittedly, using an idle time of 0 means we start the GC right at the > beginning of the (potentially short) pause, which also makes it more > likely that we'll have finished GC before the next event comes in. Starting GC immediately when Emacs becomes idle will degrade responsiveness if there's a lot of garbage, because once GC starts, it runs to completion no matter what. So maybe this "eager" GC should also be sensitive to the amount of garbage, in a sense that it should wait more if there's lot of it.