From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#58950: [PATCH] * lisp/subr.el (buffer-match-p): Optimise performance Date: Sat, 31 Dec 2022 13:56:15 +0000 Message-ID: <87a6331xts.fsf@posteo.net> References: <875yfyebi0.fsf@posteo.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="4298"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58950@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 31 14:58:16 2022 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 1pBcNM-0000x6-1H for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 31 Dec 2022 14:58:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBcMg-0005j3-0A; Sat, 31 Dec 2022 08:57:34 -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 1pBcMG-0005Yd-5K for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2022 08:57:10 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pBcMA-0006fs-3x for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2022 08:57:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pBcM9-0008Pk-QD for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2022 08:57:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 31 Dec 2022 13:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58950 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58950-submit@debbugs.gnu.org id=B58950.167249497932273 (code B ref 58950); Sat, 31 Dec 2022 13:57:01 +0000 Original-Received: (at 58950) by debbugs.gnu.org; 31 Dec 2022 13:56:19 +0000 Original-Received: from localhost ([127.0.0.1]:36798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBcLS-0008OT-Q7 for submit@debbugs.gnu.org; Sat, 31 Dec 2022 08:56:19 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:57061) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBcLQ-0008OE-61 for 58950@debbugs.gnu.org; Sat, 31 Dec 2022 08:56:16 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 5E68224024C for <58950@debbugs.gnu.org>; Sat, 31 Dec 2022 14:56:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1672494970; bh=jbDVyM6/x8gjcT86TK3jHbBUeMe5t4rJaXCPVie3y78=; h=From:To:Cc:Subject:Date:From; b=c93KTAS6uxiGBSgmSeduqCn3/JS1SN34Rxc0w8IMnd4yIjTnvl1WlB/MG6DwDAvUb S6ZxodPT8bMnrdfB1JgUyqMjQZYjoABFdCF8vZEQhjIx9PZt45vDkDkuwPQDPWET+J XottXPFfUUSAAu0adayauEpTcmF3OC2y3H95cPUsJCIXG3N3iP/bYbR/DG0sgHIK6Y JUCf8l8e3hJJpPkckGoFuQ1BHTlMCiyBbnS6CEOsHLs69fMaUTEDjU5tqGnk1DgIUo UqbVhW92zaBzC57tOm7CqSYwWXlkgzpr6zc6vdUP7RYqVQ8RHNH8Z0LxMHBzkpjx1C ze76kvNpc6HaQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NkkDn4W2Tz9rxF; Sat, 31 Dec 2022 14:56:09 +0100 (CET) In-Reply-To: (Dmitry Gutov's message of "Mon, 7 Nov 2022 03:04:35 +0200") 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:252189 Archived-At: Dmitry Gutov writes: > On 01.11.2022 21:11, Philip Kaludercic wrote: >> 1. Style. I wrap the defun in a let (or rather letrec) block to avoid >> littering the global namespace. It isn't necessary, and one could >> argue it makes debugging more difficult. >> 2. Caching policy. Caching is critical to this optimisation. Just >> using byte-compilation would cause the above test to slow down to >> (76.323692627 656 57.088315405). The question is if the hash map >> will collect too much garbage over time, and if there is a better >> approach that could be taken? > > I'd like to let our language-level specialists to take the deeper look. > > This approach looks the most straightforward, but there could be > others, just like "compiling" the form inside defcustom setter (for > project-kill-buffer-conditions, and every similar option), doing > precompilation closer to where the rules are used (similar to > font-lock-compile-keywords), or not doing any of that. All depending > on how long a typical compilation takes, and how many buffers the user > has to have, to see any noticeable benefit. > > On the last note, I'm curious how many buffers would it take to see a > 50ms improvement in match-buffers' runtime when using the current > project-kill-buffer-conditions's value, for example. Ping? If this change is too controversial, I'd like to backport the changes from bug#58951 and apply them since they are fixing an actual bug.