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


Message #283 received at 66117 <at> debbugs.gnu.org (full text, mbox):

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>, mattias.engdegard <at> gmail.com,
 66117 <at> debbugs.gnu.org
Subject: Re: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening
 large number of buffers
Date: Thu, 14 Dec 2023 14:56:18 -0500
>>> I must say I don't understand the reasoning behind this.
>>> What would it do different from `case-fold-search`?
>> It won't be buffer-local-if-changed, so binding it will not be costly.
>> It also won't be a defcustom, so let-binding it will not step on the
>> user's preferences.
> In my mind, another benefit is that the new variable will not be
> affected by buffer-local values - (let (case-fold-search-override value) ...)
> will be guaranteed to use VALUE everywhere, even if current buffer is
> changed. This will make the case I described in
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66117#208 more predictable
> (and, since it is a new variable, will not break any existing code).

But of course, as always it cuts both ways.  E.g. if you do

    (let ((case-fold-search-override t))
      (dolist (buf (buffer-list))
        (when (string-match "foo" buffer-file-name)
          (do-something))))

your `case-fold-search-override` will override all the careful
`case-fold-search` let-bindings used during the execution of `do-something`
which will likely lead to new bugs.

[ Say, if `do-something` ends up calling `syntax-ppss` which ends up
  running `syntax-propertize` which often needs to perform
  case-sensitive searches.  ]


        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.