Subject: Re: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers

From: Stefan Monnier <[email-masked]>
Date: Sun, 17 Dec 2023 11:02:57 -0500

> Most of the DEFVAR_PER_BUFFER variables behave just like any
> normal variable.  They just use a different implementation strategy and
> the C code works hard to hide that difference.

BTW, one reason why the C code works hard to hide that difference is
that we already have enough different kinds of variables making life
complicated for the poor ELisp coders:
- lexical vars
- "normal" vars  (`defvar`)
- buffer-local vars (`make-local-variable`)
- automatically buffer-local vars (`make-variable-buffer-local` or DEFVAR_PER_BUFFER)
- always buffer-local vars (DEFVAR_PER_BUFFER plus a -1 value in buffer_local_flags)
- integer-only vars (DEFVAR_INT)
- boolean-only vars (DEFVAR_BOOL)
- aliases (defvaralias)
- so-called "terminal-local" vars which are actually keyboard-local, where
  several "terminals" can share the same keyboard (DEFVAR_KBOARD), tho
  nowadays this virtually never happens, but makes for extra complexity/bugs.
[ And we used to also have frame-local vars, as well as simultaneously
  frame-local and buffer-local vars, but we got rid of those.  ]

        Stefan