[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large nu
From: |
Eli Zaretskii |
Subject: |
bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers |
Date: |
Tue, 12 Dec 2023 19:26:13 +0200 |
> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, dmitry@gutov.dev,
> 66117@debbugs.gnu.org
> Date: Tue, 12 Dec 2023 16:33:05 +0000
>
> - Then, `set_default_internal', for any variable with positive
> buffer_local_flags loops over all the live buffers to overwrite the
> buffer-local value.
>
> This loop is the bottleneck, making let-binding
> of `case-fold-search' (and any other variable marked in buffer.c:4691
> block) scale with the number of open buffers.
>
> - 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 ## _)
>
> and replace the loop with simply setting buffer_overrides slot.
So for starters, we make each BVAR more expensive, i.e. make Emacs
uniformly slower (because we call BVAR all over the place). And then
I'm not sure I understand how buffer_overrides will get the values of
those temporary bindings without having to use the same loops when we
have let-binding within another one. Also, what about threads?
- bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers, Ihor Radchenko, 2023/12/12
- bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers, Stefan Monnier, 2023/12/12
- bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers, Dmitry Gutov, 2023/12/12
- bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers, Stefan Monnier, 2023/12/12
- bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers, Dmitry Gutov, 2023/12/12