From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: mail@daniel-mendler.de Newsgroups: gmane.emacs.bugs Subject: bug#46326: 27.1.50; Excessive memory allocations with minibuffer-with-setup-hook Date: Tue, 09 Feb 2021 01:19:05 +0100 Message-ID: <558af936c04bf691e6eb953e2212bccd@mendler.net> References: <87v9b29aia.fsf@miha-pc> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8752"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.2-git Cc: 46326@debbugs.gnu.org To: jakanakaevangeli Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 09 03:37:32 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1l9IuB-00028H-LO for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 03:37:31 +0100 Original-Received: from localhost ([::1]:36174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9Iu8-0005EK-GG for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Feb 2021 21:37:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9Iti-0005Dk-Pg for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 21:37:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9Iti-00075d-Iu for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 21:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l9Iti-0001Na-GJ for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 21:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: mail@daniel-mendler.de Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Feb 2021 02:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46326 X-GNU-PR-Package: emacs Original-Received: via spool by 46326-submit@debbugs.gnu.org id=B46326.16128381685240 (code B ref 46326); Tue, 09 Feb 2021 02:37:02 +0000 Original-Received: (at 46326) by debbugs.gnu.org; 9 Feb 2021 02:36:08 +0000 Original-Received: from localhost ([127.0.0.1]:52262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9Ism-0001MO-0Z for submit@debbugs.gnu.org; Mon, 08 Feb 2021 21:36:07 -0500 Original-Received: from server.qxqx.de ([178.63.65.180]:38014 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9GkJ-0004aW-2a for 46326@debbugs.gnu.org; Mon, 08 Feb 2021 19:19:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:Content-Transfer-Encoding:Content-Type:MIME-Version; bh=RRRK5zNY4kWI4Tv+wtnv0Z4j8bS6ROXfR68b45BMacM=; b=wQU8dT/nLuRryoIuLToDvbEU4RT1korEW6R468I/GELqRyfRSXPgRELYF0oqZiC6o2EOjR27gzratow4/+oJZkG4C/0w7GKBqB0Q61P7FQK2zd/a+3YXAsxnvxt1EKtpUW5fv0llWLZBrRnsah43s8iKwWprEQxIf0xaXN8DrmY=; In-Reply-To: <87v9b29aia.fsf@miha-pc> X-Sender: mail@daniel-mendler.de X-Mailman-Approved-At: Mon, 08 Feb 2021 21:36:03 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199649 Archived-At: On 2021-02-08 10:25, jakanakaevangeli wrote: > I seem to have solved the problem by doing the following simple > substitutions in add-hook and remove-hook: > > (alist-get ... #'equal) -> (alist-get ...) > equal -> eq > member -> memq > delete -> delq > > This changes the behaviour of add/remove-hook a little, for example > > (add-hook (lambda () (test))) > (remove-hook (lambda () (test))) > > will not be reverse operations anymore, since the two lambdas are not > eq > as they are created separately. But the performance gain for big > non-compiled closures might be worth considering. Thank you, this also seems like a possible solution. However I fear that it is way to intrusive and could break a lot of existing code. As I mentioned before set-transient-map avoids adding a letrec-lambda via add-hook because it would make problems with equal. This means the "broken nature" of add-hook is somehow accepted pervasively over the Emacs codebase. My fix is less intrusive in the sense that it would just fix `minibuffer-with-setup-hook'.