GNU bug report logs - #66117
30.0.50; `find-buffer-visiting' is slow when opening large number of buffers

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Wed, 20 Sep 2023 08:53:02 UTC

Severity: minor

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 66117 <at> debbugs.gnu.org
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
On 08/10/2023 14:25, Ihor Radchenko wrote:
> Dmitry Gutov <dmitry <at> gutov.dev> 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))






This bug report was last modified 1 year and 135 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.