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: Thu, 5 Oct 2023 20:14:28 +0300 Message-ID: References: <878r919qfh.fsf@localhost> <72c93fb0-bf3e-3dad-69c0-2147cfa40f57@gutov.dev> <8734yqodqr.fsf@localhost> <87zg0xia10.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="1536"; 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: 66117@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 05 19:16:01 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 1qoRxA-000Ad4-G7 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Oct 2023 19:16:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoRww-0008Gc-0P; Thu, 05 Oct 2023 13:15:46 -0400 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 1qoRwu-0008GI-DN for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 13:15:44 -0400 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 1qoRwu-0004wh-4o for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 13:15:44 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qoRxC-0006YE-8o for bug-gnu-emacs@gnu.org; Thu, 05 Oct 2023 13:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Oct 2023 17:16: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.169652610325104 (code B ref 66117); Thu, 05 Oct 2023 17:16:02 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 5 Oct 2023 17:15:03 +0000 Original-Received: from localhost ([127.0.0.1]:48440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoRwC-0006WD-0P for submit@debbugs.gnu.org; Thu, 05 Oct 2023 13:15:03 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:59629) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qoRw6-0006Vy-Qc for 66117@debbugs.gnu.org; Thu, 05 Oct 2023 13:14:59 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 167DC5C0553; Thu, 5 Oct 2023 13:14:31 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 05 Oct 2023 13:14:31 -0400 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:sender:subject:subject:to:to; s=fm1; t= 1696526071; x=1696612471; bh=R7VVC+mKjDOzvfLZxSvXerY0aZyPlcGV9VI McE+dMNo=; b=VDL/AMNfPB7ZquqhefZe7KSpR6tCnBWRIUWUpupzPag43YaqAAB 1G3BaMTFg6nfS4vTSnbzWnjjvpYGl8CetBu5QhyvyJGpxDoaxjoOd2d15FBX4Czd 8onZ3lHQPGRtM9dTzz90T7mAeHcDF61gqGXmb83qfOdMwnSCrxiC4Ucq5ibAoX/+ /9LRfZKqWlo+QLwZGxbLvjMmjGJKLCZ+DPLbkr1j3HRfKfnU/fJsX95j1TwKxVwS BCrhJXzHWIxj10eHjLvrw9qtGfHKF251NyRKODX7GkoHm2x0MX7WgBbLz0+r9LV0 15/+9Mu9cENgIHEoY0b4S0o6sVsbu4R3v2A== 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:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1696526071; x=1696612471; bh=R7VVC+mKjDOzvfLZxSvXerY0aZyPlcGV9VI McE+dMNo=; b=SA+jgIWhaxYk5j6NUdPPIRyIGRjHrZFLq29ZVcvaKGlmFYaLudz r6GPArP3zgQBDwfhDLyUKT/QicEE+OKExxEreh8vJfkw0DPNfFbXWXMi8lnXAOx4 zQM5iDjULIRcBEg1pj8ZoEDqiqdG5DkMQFYioUsxPIegbEH4w94/fOCUJuku3LoQ gLdeR0JqQMgkEd3AuvYozvnAV5ctgkGpCyHqZVLU3FHBa+2PqSn7CJvxjJ360xiB 29z0zwVrw2STyVR5pcTNo63sKcp8Ye1qVAd/uwRdOjC9lebPERG717IX7BNEEXOP exSuctHQumCaq83GGgBbxIdaURIQzDFMReg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrgeeggddutdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfevfhfhjggtgfesth ejredttdefjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehg uhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpeeigfetveehveevffehledtueekie eikeeufeegudfgfeeghfdulefgfeevledvveenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 5 Oct 2023 13:14:30 -0400 (EDT) Content-Language: en-US In-Reply-To: <87zg0xia10.fsf@localhost> 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:271902 Archived-At: On 05/10/2023 14:27, Ihor Radchenko wrote: > Looking into `xref--find-file-buffer', all it does is memoizing the > previous call. I think that we can easily achieve the same performance > improvement by maintaining approximate cache for Fget_file_buffer - > something like > (if (and (gethash file cache) > (equal (buffer-local-value 'buffer-file-name (gethash ...)) file)) > > ) > > Or maybe even cache the last call separately to not pay `gethash' call price. That works for the Xref's scenario (where, when there are many matches, they would tend to come several per file), but I'm not sure it's a good caching strategy in general. And applications that are suited for it might as well write a small wrapper like I did. > 100% reliable cache is not necessary in this scenario. And not necessary > in my scenario, as I have found via my benchmarks in another message. IIUC a cache that keys on non-abbreviated/non-expanded filenames would be able to speed all that up anyway. But a more algorithmic improvement first would be better, of course.