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: Sun, 8 Oct 2023 15:11:53 +0300 Message-ID: <48507f04-25d4-56b0-f16f-50b2a01ac41e@gutov.dev> References: <878r919qfh.fsf@localhost> <834jjm749q.fsf@gnu.org> <87cyyawd1a.fsf@localhost> <83pm2a5k85.fsf@gnu.org> <87wmwh2tae.fsf@localhost> <83zg1d468w.fsf@gnu.org> <87bkdr2651.fsf@localhost> <87pm2584oz.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> <87o7h9pd9b.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="31728"; 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: Eli Zaretskii , 66117@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 08 14:13:03 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 1qpSec-0007zm-40 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 Oct 2023 14:13:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpSeK-0001CZ-4S; Sun, 08 Oct 2023 08:12:44 -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 1qpSeI-0001CE-PE for bug-gnu-emacs@gnu.org; Sun, 08 Oct 2023 08:12:42 -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 1qpSeI-0004F5-Gt for bug-gnu-emacs@gnu.org; Sun, 08 Oct 2023 08:12:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qpSec-0000Ya-DK for bug-gnu-emacs@gnu.org; Sun, 08 Oct 2023 08:13: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: Sun, 08 Oct 2023 12:13: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.16967671452093 (code B ref 66117); Sun, 08 Oct 2023 12:13:02 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 8 Oct 2023 12:12:25 +0000 Original-Received: from localhost ([127.0.0.1]:56459 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qpSe0-0000Xh-Iq for submit@debbugs.gnu.org; Sun, 08 Oct 2023 08:12:24 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:49661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qpSdy-0000XS-76 for 66117@debbugs.gnu.org; Sun, 08 Oct 2023 08:12:22 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.nyi.internal (Postfix) with ESMTP id 1769B5C0253; Sun, 8 Oct 2023 08:11:57 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 08 Oct 2023 08:11:57 -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= 1696767117; x=1696853517; bh=vJWH5MYyvU4a2QXtTLZKNUfOYs3UNJBb1ue 4K9qDtI0=; b=Y3zqjg3y8SgMNc3pMBeb5HTWolji60GQTDHGg+rbYfTLKeNOtaB 4pH5w1rw6yCZ0g12Ca5XoTJ1xMjxkdrvWw/WfF5uNRzmX8GEpOSNuWZWrB1vuUw1 oAdli9wPRRuo2mj0uZjFV0TEEMECAupfvj+jBRcxApDCgrIU2yB2J1mJCNwBaZ/B fijqFvsm1Lwi0DjiXTggo/uSXmTqd65/p4/6mp37BMlhXJ+0t51EzWseICqgpHYs roU7r9YQ7MOu1GM1aSrWsZufKgSPUXCMv/lmX68k/tBku3XY4315Yqv2xs3IYnGi uRnbwfHvH51KCFbhZFT3Ba1HsOZUVigZCKg== 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= 1696767117; x=1696853517; bh=vJWH5MYyvU4a2QXtTLZKNUfOYs3UNJBb1ue 4K9qDtI0=; b=aJBqNBpBeyEKjjjcKqg0IUXl9yQ2BIaDWwztd8OpiNv4feDQP+5 RSgjzLwKRY8eYXwdInmPAKFEE61ZYG2QjwEHn7y4oPpVomb3hYmm2wRzdnkRPeMN MY7NtZCChXw5qS7rbwOzNUGqTl4bCbKlrdv2ElZrOZmMTmkKX8j4f/huM9c7k10M VDEo/R961g4oMjBFR/DJsVEiPZ5At2nfImRcN05GghBnUvr5t2REH9nBRGNjoHaC yewCkoE1/RkO3O3Rw23ZRoEwFKnbshJxPOEo0sQGbvd4dk095g2+9nB9CzzhYQaT caQp28KtMSYAEKo8dciMi3/e3avVak8lpbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrhedugdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeevledv veenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 8 Oct 2023 08:11:55 -0400 (EDT) Content-Language: en-US In-Reply-To: <87o7h9pd9b.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:272089 Archived-At: On 08/10/2023 14:25, Ihor Radchenko wrote: > Dmitry Gutov writes: > >> On 08/10/2023 12:00, Ihor Radchenko wrote: >>> I am not sure if we really need to squeeze the >>> performance yet further from `find-buffer-visiting' - `file-attributes' >>> is taking pretty much no time: >> >> If file-attributes is the main source of consing, it could be the reason >> for the line >> >> 924 36% Automatic GC > > No, the main source of consing, according to the memory profiler, is > `inhibit-local-variables-p': > > 170,592,016 49% + inhibit-local-variables-p > 45,619,488 13% + string-match > 28,171,152 8% + insert-file-contents > 26,066,069 7% + file-name-sans-versions > 18,699,245 5% + file-remote-p > > The full memory profile is attached. That's odd. Do many/any of your files being visited match inhibit-local-variables-suffixes or inhibit-local-variables-regexps? This might help a little bit: diff --git a/lisp/files.el b/lisp/files.el index b99ccf66d8a..8cab08bc6b6 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3208,7 +3208,7 @@ inhibit-local-variables-p sufs) (setq name (substring name 0 (match-beginning 0)))) (while (and temp - (not (string-match (car temp) name))) + (not (string-match-p (car temp) name))) (setq temp (cdr temp))) temp))