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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 22 Sep 2023 16:10:05 +0300

> Cc: [email-masked]
> Date: Fri, 22 Sep 2023 16:02:59 +0300
> From: Dmitry Gutov <[email-masked]>
> 
> I think variable watchers are mostly for debugging?

It is also okay to use watchers when there's no other way of reacting
to a change.  For example, if we need to do something when some
variable is changed that is exposed to Lisp.

> I was thinking of a straight approach where the base primitives that
> visit a file or kill a buffer update said cache.

Yes, in this case find-file-noselect could update the cache.