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: Lisp-level macro to avoid excessive GC in memory-allocating code Date: Fri, 01 Jul 2022 09:56:52 -0400 Message-ID: References: <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> <87v8shk1c5.fsf@localhost> <83wncxe4pr.fsf@gnu.org> <87k08xjmlm.fsf@localhost> <83r135dsbn.fsf@gnu.org> <877d4xjddm.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="1718"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Eli Zaretskii , mattiase@acm.org, theophilusx@gmail.com, rms@gnu.org, acm@muc.de, emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 01 16:17:23 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 1o7HST-00006L-9m for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Jul 2022 16:17:21 +0200 Original-Received: from localhost ([::1]:43772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7HSR-0000J5-Oh for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Jul 2022 10:17:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7H8n-0006R5-Gc for emacs-devel@gnu.org; Fri, 01 Jul 2022 09:57:01 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7H8k-0001g0-TU; Fri, 01 Jul 2022 09:57:00 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9DE0380723; Fri, 1 Jul 2022 09:56:56 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5B40D8027D; Fri, 1 Jul 2022 09:56:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1656683815; bh=O2HxPG29sG1zy6eASHCA8YMHNIBRPnAEiojF6JTZnwc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=a/euukiGjIBARdZ//ij55LnPxcF4TNFn0PykPHrBWs8hKJnBxwCEVsigf79XjwrrO l+MMW2FobLeGGG/Uml08ViiKAHgkXSW8aQuQVszVEu9+ZqqIHkA+0HpMMdrA8+x3pM 0Dkqq6OtmIFhHzdmT6H60zXPD/IwAMpw6ZLm4hJpb7Ldbb6EY2MFSLeKWfma8Uc2TT WRiK4dZFJ8zhmvVKHNIlVxfebKcdfiq45hLvcYJMI2mCJpuei0/L511D7uJJLPYOJZ zdtxCQhMpporGvh18LSviZqnxQamON1/DqjYBJ0b+CTcBjTxoHv0G+OXPpdRfEiN6m tdZ2o00M0XIrg== Original-Received: from alfajor (unknown [45.72.196.165]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0A2C61204BE; Fri, 1 Jul 2022 09:56:54 -0400 (EDT) In-Reply-To: <877d4xjddm.fsf@localhost> (Ihor Radchenko's message of "Fri, 01 Jul 2022 19:12:05 +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:291781 Archived-At: >> Is this aligned with what the implementation of the Lisp interpreter >> actually does? I'm not sure we know, where we allocate memory for >> Lisp data, whether we are going to bind some variable to the produced >> data. Thus "count recent allocations within the current sexp" sounds >> like non-trivial to implement. That's also my impression. > I am not 100% sure, but AFAIK lisp interpreter always knows the current > lisp nesting level. Not really, no. There is some related info, but that's a non-trivial part of the cost of interpretation so any increase to that info will tend to slow us down. A simple `with-mostly-allocating-code` macro that increases `gc-cons-percentage` to 1.0 sounds a lot simpler and won't impose any extra burden on "normal" code. Stefan