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: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: dmitry <at> gutov.dev, 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: Tue, 12 Dec 2023 15:01:56 -0500
> - What I propose is to avoid this loop in `do_specbind' altogether.
>   Instead of having to loop through all the buffers to set temporary
>   buffer-local value, I propose to introduce special buffer object
>   `buffer_overrides' that will hold such temporary bindings.
>   Then, we can change BVAR to something like
>
>   #define BVAR(buf, field) (buffer_overrides->field ## _ == UNSET ?\
>                               (buf)->field ## _ :\
>                              buffer_overrides->field ## _)

If we're willing to pay the cost of such a test, then we don't need
a new `buffer_overrides`, we can just set `buf->field` to a special value
(e.g. `Qunbound`, tho we'll probably need to use a new similar special
value) and then do:

    #define BVAR(buf, field) ((buf)->field ## _ != Qunbound ?\
                                (buf)->field ## _ :\
                               buffer_defaults->field ## _)

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).


        Stefan





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

Previous Next


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