[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48264: 28.0.50; Changing the default for DEFVAR_PER_BUFFER variables
From: |
Spencer Baugh |
Subject: |
bug#48264: 28.0.50; Changing the default for DEFVAR_PER_BUFFER variables takes O(#buffers) time |
Date: |
Thu, 06 May 2021 16:24:30 -0400 |
When changing the default for a Lisp variable defined in the C source
with the DEFVAR_PER_BUFFER macro, whether by let or by set-default, it
takes time proportional to the number of currently live buffers.
Note, DEFVAR_PER_BUFFER variables are stored as Lisp_Object fields in
struct buffer.
The cause of the pathological performance is that setting a default for
a DEFVAR_PER_BUFFER variable iterates over every struct buffer (that
doesn't already have a binding) to set the field corresponding to the
variable.
This is because accessing a DEFVAR_PER_BUFFER variable is done purely by
looking at the current buffer, even if the buffer doesn't have a local
binding for the variable.
This issue was previously reported in bug#41029 and noticed as part of
several other bugs.
I have a patch series which fixes this issue by making DEFVAR_PER_BUFFER
variable accesses fall back to the default if there's no local binding
for the variable, which I'll send shortly as a followup.
- bug#48264: 28.0.50; Changing the default for DEFVAR_PER_BUFFER variables takes O(#buffers) time,
Spencer Baugh <=
- bug#48264: [PATCH v3 01/15] Stop checking the constant default for enable_multibyte_characters, Spencer Baugh, 2021/05/06
- bug#48264: [PATCH v3 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, Spencer Baugh, 2021/05/06
- bug#48264: [PATCH v3 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, Eli Zaretskii, 2021/05/07
- bug#48264: [PATCH v4 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 06/14] Rearrange set_internal for buffer forwarded symbols, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 11/14] Set buffer_defaults fields without a default to Qunbound, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 13/14] Remove PER_BUFFER_IDX and buffer_local_flags, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 14/14] Add and use BVAR_FIELD macros, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 05/14] Add and use KILL_PER_BUFFER_VALUE, Spencer Baugh, 2021/05/07