From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Garbage collector: is 800kb a good default? Date: Thu, 09 Apr 2020 14:42:56 -0400 Message-ID: References: <83h7xsoi03.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="72044"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: dim1212k@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 09 20:44:07 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 1jMc9m-000IfR-B5 for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Apr 2020 20:44:06 +0200 Original-Received: from localhost ([::1]:54058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMc9l-0005l0-Bt for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Apr 2020 14:44:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51308) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMc8l-0005Eh-Ua for emacs-devel@gnu.org; Thu, 09 Apr 2020 14:43:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jMc8k-0006G9-A3 for emacs-devel@gnu.org; Thu, 09 Apr 2020 14:43:03 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40664) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jMc8i-0006FP-NU; Thu, 09 Apr 2020 14:43:00 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 11755100D4F; Thu, 9 Apr 2020 14:43:00 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D4321100E11; Thu, 9 Apr 2020 14:42:57 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1586457777; bh=7MmFVD4f1Heka9KV7u7x0p6KcT8722QDYu9TqaNHSgU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=kq3EIYSFcRYKWHBFhKPtJK39pUdd9fblGKtWfCV57ICoy28L1ZYZAuDB9iGu1W4Ik FYJosQofU1mZ6xAjJiX5GaoE9M0kBuVqprIZSm4kSyHyqMnMZUlB7t0kwBZW3FyQAI u5/JXgrCJAOBxTuhFmxuM8VveUiQGPQCHy+TXEVf8TgEuvTxptmXkK4lvZ8NYYCO2X z91gA8APqM0AL5zi/jiLmRQcmiGsHD4ExbPOcLyaqyT//N+QdyTr/I5HIkwU2TUs/q 9pv+LtGQMRp4Rn6O3I9MFAqpkZIi7rt0eIenPV8UhhksEpDVrvvuzH3ouXkcyahohm 7gjfU36VZoywA== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7DA0A120055; Thu, 9 Apr 2020 14:42:57 -0400 (EDT) In-Reply-To: <83h7xsoi03.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 09 Apr 2020 17:23:24 +0300") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 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:246721 Archived-At: >> 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