From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68214: Completion sorting customization by category Date: Thu, 02 Jan 2025 18:29:15 +0100 Message-ID: <87ikqxcefo.fsf@daniel-mendler.de> References: <86a5pnzst1.fsf@mail.linkov.net> <868r5630ft.fsf@mail.linkov.net> <8ebc33fb-d01f-4426-a716-69a11f6dfad1@daniel-mendler.de> <86le95m2ue.fsf@mail.linkov.net> <86sf3cjj6o.fsf@mail.linkov.net> <871qawrxh0.fsf@daniel-mendler.de> <86r0iuxu4f.fsf@mail.linkov.net> <87plye9wbz.fsf@daniel-mendler.de> <86wmslhvdk.fsf@mail.linkov.net> <87h6jpdm63.fsf@daniel-mendler.de> <86o7dul766.fsf@mail.linkov.net> <86il42l6gz.fsf@mail.linkov.net> <87jzoiqryx.fsf@daniel-mendler.de> <87ldvtci2f.fsf@daniel-mendler.de> Reply-To: Daniel Mendler Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12277"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 68214@debbugs.gnu.org, Juri Linkov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 02 18:30:27 2025 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 1tTP1d-00030S-Kk for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Jan 2025 18:30:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTP1P-0005Vg-LX; Thu, 02 Jan 2025 12:30:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTP1I-0005Ql-4a for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 12:30:06 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTP1H-0007Gj-Kh for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 12:30:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=dhMjDdoGmE9S9W/cMhyUHSHeKTRaTh0poP2O3gA1Nn8=; b=pdd5WVCw6OL5PVP7W+ZGh3TNwfu/v7yaeBfzqs81EOR1g27wn61qd+dTXsV2sQQUDDSNcBuURxhJKDCiIj7Ve8e3Q5xjQx6/pEksjaSpBmAH5hbo21AuENkd3BtU6mEXOH5SNqlir9EHwc1oMKAkUxuKxLsEv86G4UDwAkMFFb2TiCrTBesEyWJt1DbQmt1JpTiT0g6/czn6NRRNCMdoI7TrRpyj+M9R2b1j2+KR0i0E7LcrpCQPvMjl1OX7S+B3eb9cj2f+IWejkAG/8Uo4tldeO3a19y4NFbDbqPDublDfZaeWrZ3X7y5tqjIdR+XNdInLMGtoDb7OiOQYkEePIg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTP1H-0004oy-DE for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 12:30:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Jan 2025 17:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68214 X-GNU-PR-Package: emacs Original-Received: via spool by 68214-submit@debbugs.gnu.org id=B68214.173583896818432 (code B ref 68214); Thu, 02 Jan 2025 17:30:03 +0000 Original-Received: (at 68214) by debbugs.gnu.org; 2 Jan 2025 17:29:28 +0000 Original-Received: from localhost ([127.0.0.1]:46456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTP0h-0004nD-Ur for submit@debbugs.gnu.org; Thu, 02 Jan 2025 12:29:28 -0500 Original-Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:37765 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTP0f-0004mo-To for 68214@debbugs.gnu.org; Thu, 02 Jan 2025 12:29:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dhMjDdoGmE9S9W/cMhyUHSHeKTRaTh0poP2O3gA1Nn8=; b=gFcPVfS9SxShWNaU2T60RyLjd7 cUSdggeJ4+OslxuF1U10EoiSQJ9nsBt9l56cA29eqcbR4qFech4dio1KGoiLEbOsNQ/OETgJs0Ypg SxAbXSr5xye0u8HKt6tgDrAbrgJfCm++pCH8RfgdINiRePVqBIM7y628BpPSejE3XFY4=; In-Reply-To: (Stefan Monnier's message of "Thu, 02 Jan 2025 12:09:01 -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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298204 Archived-At: Stefan Monnier writes: >>> Why do we need this memoization? If it's performance sensitive wouldn't >>> it more effective to cache at a higher level (e.g. to memoize >>> `completion-metadata-get`)? >> >> The memoization ensures that `completion-metadata-get' doesn't allocate >> and performs a symbol lookup only, as has been the case before the >> addition. The function is called often from completion UIs which >> auto-update on every keypress. > > I understand there is a benefit. I just wonder how important it is in > practice (if it's done 2-3 times per keypress it's likely lost in the > noise) and whether it's the best place to put it. Well, for comparison, in Corfu people asked me not to repeatedly recreate timer objects on every key press and instead reuse them, so the accumulated garbage matters somewhat. I think it is better not to degrade functions which have been cheap before, such that they become significantly more costly, even if the function may not matter that much in the greater scheme. I'd appreciate if we keep the function as is, unless you are bothered too much by it. I've ported this back to compat-30 already and it is in the emacs-30 branch. But maybe add with-memoization for conciseness? Daniel