From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jakanakaevangeli Newsgroups: gmane.emacs.bugs Subject: bug#46326: 27.1.50; Excessive memory allocations with minibuffer-with-setup-hook Date: Mon, 08 Feb 2021 10:25:33 +0100 Message-ID: <87v9b29aia.fsf@miha-pc> References: <62c490ed0d8d24d8b259ac1ba55ea79e@mendler.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21386"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46326@debbugs.gnu.org To: mail@daniel-mendler.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 08 17:23:52 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 1l99KK-0005T4-7K for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Feb 2021 17:23:52 +0100 Original-Received: from localhost ([::1]:45724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l99KI-0005k1-VD for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Feb 2021 11:23:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l92m7-0007gL-Lp for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 04:24:11 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38252) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l92m1-0005tN-VA for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 04:24:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l92m1-00033t-RU for bug-gnu-emacs@gnu.org; Mon, 08 Feb 2021 04:24:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <62c490ed0d8d24d8b259ac1ba55ea79e@mendler.net> Resent-From: jakanakaevangeli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Feb 2021 09:24:01 +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.161277623711757 (code B ref 46326); Mon, 08 Feb 2021 09:24:01 +0000 Original-Received: (at 46326) by debbugs.gnu.org; 8 Feb 2021 09:23:57 +0000 Original-Received: from localhost ([127.0.0.1]:49798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l92lw-00033Z-N9 for submit@debbugs.gnu.org; Mon, 08 Feb 2021 04:23:56 -0500 Original-Received: from chiru.no ([142.4.209.132]:46004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l92jo-00030G-3R for 46326@debbugs.gnu.org; Mon, 08 Feb 2021 04:21:45 -0500 Original-Received: from localhost (BSN-77-156-43.static.siol.net [193.77.156.43]) by chiru.no (Postfix) with ESMTPSA id EF307128001C; Mon, 8 Feb 2021 09:21:42 +0000 (UTC) X-Mailman-Approved-At: Mon, 08 Feb 2021 04:23:54 -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:199601 Archived-At: 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.