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


Message #229 received at 66117 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: dmitry <at> gutov.dev, 66117 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening
 large number of buffers
Date: Wed, 13 Dec 2023 13:43:23 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> AFAIU, it is very hard to rewrite them in C, as I explained in
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66117#157
>
> The only explanation I see there is that they "recursively call
> other Elisp functions".  Is there any other reason?

The main problem I see is that `abbreviate-file-name' uses a number of
variables, including customizations, defined in ELisp. I suspect that
moving all of those to Elisp will neither be easy nor practical.

> My point is that by trying to speed-up let-binding of case-fold-search
> and similar variables you are trying to solve a much more general
> problem, and a much harder one at that.  IME, if an idea for a
> solution leads to a more general and harder-to-solve problem than the
> original, then the idea should be dropped, and one should look for
> alternative ideas.

The simplest solution would be what `ido-make-buffer-list-1' does:

    ;; Each call to ido-ignore-item-p LET-binds case-fold-search.
    ;; That is slow if there's no buffer-local binding available,
    ;; roughly O(number of buffers).  This hack avoids it.
    (setq-local case-fold-search nil)

But it will only solve specific problem with `find-buffer-visiting' and
we can always go for it if we cannot find anything better.

I thought that trying to solve a more general problem would benefit more
code - let-binding case-fold-search is extremely common across packages.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




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.