From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers Date: Wed, 13 Dec 2023 01:40:03 +0200 Message-ID: <2d355bf6-7fca-a733-d656-aeee701901b2@gutov.dev> References: <878r919qfh.fsf@localhost> <83cyy11ln1.fsf@gnu.org> <87lecp84mf.fsf@localhost> <83ttrdx8j9.fsf@gnu.org> <87a5su261p.fsf@localhost> <838r8e24yy.fsf@gnu.org> <87y1gezspg.fsf@localhost> <834jj21z05.fsf@gnu.org> <87il7izo4l.fsf@localhost> <831qe61xrh.fsf@gnu.org> <87cyxqzmhh.fsf@localhost> <83zg0uzlgw.fsf@gnu.org> <87v8bhxzcu.fsf@localhost> <83y1gdxws8.fsf@gnu.org> <87jzrwm7ul.fsf@localhost> <87h6n0m781.fsf@localhost> <87v8935wik.fsf@localhost> <83msuftr0i.fsf@gnu.org> <87plzbxtxa.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25936"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: Ihor Radchenko , Eli Zaretskii , 66117@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 13 00:41:05 2023 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 1rDCN5-0006XA-R0 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Dec 2023 00:41:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDCMq-0006Zu-SB; Tue, 12 Dec 2023 18:40:48 -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 1rDCMp-0006Zk-Gw for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 18:40:47 -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 1rDCMo-0003CC-VJ for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 18:40:47 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rDCN4-0005Cu-FK for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 18:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Dec 2023 23:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66117 X-GNU-PR-Package: emacs Original-Received: via spool by 66117-submit@debbugs.gnu.org id=B66117.170242443219972 (code B ref 66117); Tue, 12 Dec 2023 23:41:02 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 12 Dec 2023 23:40:32 +0000 Original-Received: from localhost ([127.0.0.1]:57926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDCMa-0005C4-AL for submit@debbugs.gnu.org; Tue, 12 Dec 2023 18:40:32 -0500 Original-Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:50583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDCMX-0005Bo-53 for 66117@debbugs.gnu.org; Tue, 12 Dec 2023 18:40:31 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 47F803200AD4; Tue, 12 Dec 2023 18:40:07 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 12 Dec 2023 18:40:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1702424406; x=1702510806; bh=OG5nZXz76RkLs3ORSsRLFUyILnUDWWpnVqUx6pfovOw=; b= vFS5QrVD8bHO8dClJkO6p9wI7dHoeVKZh/V33sUBELisI0q2ravs2pwJhH1W615O ZWHmEJwiFBttWy8WV+7KyNhydCkHkX5jjX99vPdNO6S70x5+yJk9RrmPhO1tNwpE p9XEX2fiMRTCvmkQMJ5EEOkbmISYyGRxi1no/F/tmv84JGkK7pAuHP9QUvYnFMJK YosmSUFPgQpzJt7dXhxBdfA5vBCZyjWuOUc1kl0Zr2i9EmbG3M7oRVUms2NNUKHV 1wzClP8a0mtrgOPwd6xdmfiifeViN8wFGG43V1zsCzpKFYlW4VgUZ2fCK5vzJ8Xu Yb75lQH75LJagKbF7VSbfw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1702424406; x= 1702510806; bh=OG5nZXz76RkLs3ORSsRLFUyILnUDWWpnVqUx6pfovOw=; b=n 4Hp911QSYBWlbBIJNslpu8aFAxX8Tr+B+QmSrffQy3cm36bUTPEW7aQ/fXnQAhXA fQl2oLkfE9yV57c9WBWzl9yLetnKhMwenWJMjI36JNHzHBCr7algfJy/mixtYUZs erwpQAGe48rz8qvr8LzpqtXxymQStrXk2wassr4Gs972yjVfhu3MQaVRSIZOXMab ODh/XlvJIlkwAfVySEO2WPeidFX+D8dyECV3uqWRaMK5nA7U3DR7aecDtMeT9fJH Iul0AN3ojd/P9JpZK9nnIbXAIfEJsOGHxg2MkG7qCMxc4OyZfagnONTSO49NL2C8 Mt9rFFXqUAevJVBV2vSbw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudelhedgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Dec 2023 18:40:05 -0500 (EST) Content-Language: en-US In-Reply-To: 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:276099 Archived-At: On 13/12/2023 00:57, Stefan Monnier wrote: >>> This said, in the case of `case-fold-search` I think there's a simpler >>> solution: make it "buffer-local only", meaning that let-binding it >>> affects only the current buffer (rather than affecting all the buffers >>> which have not made it buffer-local yet). >> Wouldn't that be a breaking change? And a non-obvious one. > Yup. > >> E.g. company-dabbrev-code creates a dynamic binding for case-fold-search in >> one place and then calls a function (company-dabbrev--search) that iterates >> across all buffers with re-search-forward. > I think we call this collateral damage. > > My suggestion was indeed not completely serious, tho I do think in the > long run it's what we should do. > > BTW, regarding making BVAR slower, we could reduce its cost by > introducing two versions of BVAR, so we only pay the price when > accessing one of the problematic variables like `case-fold-search`. Perhaps in the long run it might be good to do the opposite? Introduce never-buffer-local variables, and make case-fold-search one of them. I do see a few hits for (setq-local case-fold-search across the Emacs codebase, but in none of these I can clearly understand the end goal (is that for interactive isearch?). Except for ido-make-buffer-list-1, which is done purely for performance, working around a problem related to what's being discussed here (df4991093b94).