From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Larger GC thresholds for non-interactive Emacs Date: Sat, 18 Jun 2022 09:16:41 -0400 Message-ID: References: <83bkuzznws.fsf@gnu.org> <877d5mqmkh.fsf@localhost> <83y1y2utnd.fsf@gnu.org> <87r13up587.fsf@localhost> <83o7yyur0l.fsf@gnu.org> <87leu2p3nu.fsf@localhost> <83leu2uewn.fsf@gnu.org> <87r13qv701.fsf@localhost> <83bkuursya.fsf@gnu.org> <87h74l9jk8.fsf@localhost> <83bkutqb3z.fsf@gnu.org> <9778F176-E724-4E61-B0FB-327BCDD316C0@acm.org> <87sfo4epeo.fsf@localhost> <87bkurrc5e.fsf@localhost> <87bkur72b7.fsf@gnus.org> <87r13n5muk.fsf@gnus.org> <87bkuqwn3r.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28726"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , Mattias =?windows-1252?Q?Engdeg?= =?windows-1252?Q?=E5rd?= , Eli Zaretskii , Tim Cross , rms@gnu.org, Alan Mackenzie , emacs-devel To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 18 15:17:31 2022 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 1o2YKQ-0007Dl-L9 for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Jun 2022 15:17:30 +0200 Original-Received: from localhost ([::1]:36174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o2YKP-0007b1-H5 for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Jun 2022 09:17:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2YJn-0006r7-21 for emacs-devel@gnu.org; Sat, 18 Jun 2022 09:16:51 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o2YJk-0002Pf-Cw; Sat, 18 Jun 2022 09:16:49 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 21EE6441300; Sat, 18 Jun 2022 09:16:45 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AA57B4412AD; Sat, 18 Jun 2022 09:16:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1655558203; bh=SYgMWwsvUFxIHPr7hHvjblOeqKA+Uo4dNW5po5/qxMA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=CdxWAQVaxvajFkBIQIiICkhdTERKjZwVGqrPmZXEufXeTSfbTWisCFHRcIjuxxGB1 VXZm24HLSA6hPhaVHI3mIa0BYqvbRZHG3LThcu1rBWRFqpTGk3oFQ6s6pcFM3Ugosl 6tQzosm8Ya6XUmqAerILQpxB2PZ2+awsRJc621FXavKWCsNXEzAAHOE2h9xrxofgma 0u8iU34ie5SGt/MIKCtbSgFc8InHuNxtl+LOZNzY7cuMIVszyt1qF4wFbNvOnMyEl8 Usp3CeX7yk3Z/CdOBN0U4i+Jy/StZGq+0YnZOD1nT+J7UT+Rufoeb8u71hx5wSyTy2 BaqqyL0C94F8Q== Original-Received: from alfajor (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 49AA3120728; Sat, 18 Jun 2022 09:16:43 -0400 (EDT) In-Reply-To: <87bkuqwn3r.fsf@localhost> (Ihor Radchenko's message of "Sat, 18 Jun 2022 13:35:04 +0800") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:291364 Archived-At: Ihor Radchenko [2022-06-18 13:35:04] wrote: > Stefan Monnier writes: >> BTW, I seen everyone's focused on `gc-cons-threshold` but that variable >> does not adapt to the heap size, so maybe we'd be better off >> playing with `gc-cons-percentage`. > I am not sure if `gc-cons-percentage' is reliable. >From where I stand it's the only one that's reliable. It basically controls the percentage of *time* we spend in the GC: if we assume that the time to perform a GC is proportional to the heap size, and that the allocation rate (in MB/s) is more or less constant, then `gc-cons-percentage' directly controls the percentage of time spent in the GC. Of course, those two assumptions don't hold exactly, but they're fairly good approximations of reality. Tweaking `gc-cons-threshold` on the other hand is very coarse and brittle: if the value is significantly smaller than the heap, then we'll spend too much time in the GC and if it's significantly larger then we waste a lot of memory on garbage. There simply can't be any "one good value" for `gc-cons-threshold`. > When we have a small heap (at the beginning of the batch command run), > the GC will be triggered frequently. Yes, but the GC cycles will finish quickly. Stefan