From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitrii Korobeinikov Newsgroups: gmane.emacs.devel Subject: Re: Garbage collector: is 800kb a good default? Date: Fri, 10 Apr 2020 22:40:28 +0600 Message-ID: References: <83o8s0on41.fsf@gnu.org> <83imi8oiyp.fsf@gnu.org> <83d08gobke.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="61703"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 10 18:41:18 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 1jMwiU-000Fxs-Mm for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Apr 2020 18:41:18 +0200 Original-Received: from localhost ([::1]:36884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMwiT-0000vS-O1 for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Apr 2020 12:41:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39618) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMwi0-0000L9-Nw for emacs-devel@gnu.org; Fri, 10 Apr 2020 12:40:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jMwhz-0005oe-NB for emacs-devel@gnu.org; Fri, 10 Apr 2020 12:40:48 -0400 Original-Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:53641) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jMwhu-0005mg-8m; Fri, 10 Apr 2020 12:40:42 -0400 Original-Received: by mail-wm1-x332.google.com with SMTP id d77so2992921wmd.3; Fri, 10 Apr 2020 09:40:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=uamuLoTQZYgN4qZnR1Vu0TJtx+1e69jDyWPgWZjWTAQ=; b=qsA08pOsz5R3wphzoNXoliGK3ZY61jQWKzrSeCS66h3ZyBMNxg7bY4En48tcic+ang 3ZkY+tnZoXvFnHDx1WPsF5hW7Dzb/obXvmChrJr/lo3lqeQQ3W3DhhQdvIDNCpYKNy/p S2jgepkMyT/eT8lWeIdzMk31YNvNb7QCEgnuyKw4MEA7uiQhqC2BHqfz7P3+9l7Lbq8p t11ArGFPKnUO/YLB8MLkXeAmzas3+/mQWUzz3L1pFVgqDwiKgacZCoTXSxJbjJ9/gV2s i8HOBX45u7gGRwnDdExNYQ/WQlT/nHbl2fHqC5p+pt5Q0HSl+vstrKZYwWnmGwChGFs+ TLnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uamuLoTQZYgN4qZnR1Vu0TJtx+1e69jDyWPgWZjWTAQ=; b=feVs8DRJ8ssta7k9mvep4tmEOn7URrMgPMR8L3lqW0ez/pvQgU/nv2bCKOIw7YU/cQ d8/FYc1uK2fQvp6Ld24eF0JbCMHZgwYZidu7+yvGSRq5vwhXeyeCM17rSYiJG3P2gs6J n3HLQHIQRdjd46S41/Vqg+RTwe1uMu71ghppD7DrcKSDBBsRRnoV//gy07ZqcuENPQgf PiC0/F5m1OlhX3yaR4RGViY6EItYFC2cprmYOhpgKbiUnrwXNHtHa3ZtKMjyzTK2n7Ei gdHJT+00DtnHulKUsHOt+Ony5pfFF+w+JR76vSne+2f6wFUwcZVnszIxgOTW8Wn/wjgu kIHw== X-Gm-Message-State: AGi0PuYZQqOM4MNSAVEW/VbxGMnjnXZV3Se4+iV0YMubsR+ttGr6Op1e AYEI7UBO8AMMBeuu3xZKEgiBm1Tw4omDAsYW5QcXioXm X-Google-Smtp-Source: APiQypLNu7OqPT6E+vSmdPk5EM0qjn3Arl5ntQXE9aaaaX09LNxl/dArBz9oPE8PG8l+w6HtL3klUSYg2BTw2cxYitM= X-Received: by 2002:a05:600c:295a:: with SMTP id n26mr6453388wmd.16.1586536840221; Fri, 10 Apr 2020 09:40:40 -0700 (PDT) In-Reply-To: <83d08gobke.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 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:246779 Archived-At: > Depending on what features and packages you use frequently, your > sessions could produce more or less garbage. The optimal threshold > should depend on that. It would be hard to make general improvements unless one employs general metrics. History of garbage for the past n milliseconds, highest memory consumption for the session and such come to mind. However I am not sure how exactly gc could use these facts while guaranteeing that the benefits would outweigh the downsides (even on average). By the way, the point Stefan is making, I believe, is this: for continuous actions, if both strategies use the same amount of memory, the user is guaranteed to experience 100% of gc freeze if it's non-idle-time. Meanwhile, 100% is just the worst case for the idle-time strategy. The only tradeoff I see for the idle-time strategy is the overhead of more frequent calls to the garbage collector. About the user expecting an immediate response during the idle time: I think the user always expects an immediate response. Delay is bad in any case. Now, what from what I gather in this thread so far, the two problems with elevating the threshold are: 1. Large heap may slow down the gc. Tests are needed. 2. If a lot of garbage is generated after some process, the user will experience a lag if he interacts w/ emacs right after (well, after the idle time). This kind of scenario seems like a rarity to me. And in case it happens, the lag probably wouldn't have to be that long anyway. Plus, if it comes to that, sequential or concurrent gc solves this problem in its entirety. It would also help to know what's the point at which threshold elevation starts giving only negligible benefits. Usage patterns / scenarios are needed to test this. Best, DK =D1=87=D1=82, 9 =D0=B0=D0=BF=D1=80. 2020 =D0=B3. =D0=B2 22:42, Eli Zaretski= i : > > > From: Dmitrii Korobeinikov > > Date: Thu, 9 Apr 2020 20:46:53 +0600 > > Cc: emacs-devel > > > > > The "right" value depends on your usage patterns, among other > > > factors. How to account for that in the default value? > > > > I am not sure what you mean exactly by usage patterns. > > Depending on what features and packages you use frequently, your > sessions could produce more or less garbage. The optimal threshold > should depend on that. > > > > 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, > > > specially if gc-cons-threshold is high. So it isn't entirely "free". > > > > Maybe it would be possible to garbage collect in chunks and check > > after each chunk for input? > > AFAIU, this will be hard, since Lisp data structures are very > recursive. But maybe I'm missing something.